Been having a mare trying to load in movie templates due to application domains and flash not picking up descriptions for timeline placed assets (not linkaged). Anyway thought I would post a snipit.
public function loadImage( ):void
{
_loader = new Loader();
_loader.contentLoaderInfo.addEventListener( Event.INIT, addImage );
_loader.contentLoaderInfo.addEventListener( ProgressEvent.PROGRESS, downloadProgress );
_loader.contentLoaderInfo.addEventListener( IOErrorEvent.IO_ERROR, ioErrorListener );
var context:LoaderContext = new LoaderContext();
context.applicationDomain = new ApplicationDomain();
// may need to add other context info _loader.load( new URLRequest( _path ), context);
}
private function addImage( e: Event )
{
_mc = getLoadedSymbol();
_mc.x = _x;
_mc.y = _y;
_scope.addChild( _mc );
//you can call public methods on the instance here //_mc.start( _info ); dispatchEvent( new SimpleLoaderCustomEvent( SimpleLoaderCustomEvent.VISUALLOADED, true, false, _path, _mc ));
}
// finds the loaded movies main class
// and casts the loaded movie properly so that flash knows it inherits from Movieclip and
// can return the loaded instance, as a MovieClip with
appended methods (MovieClip instances are dynamic) // create by jlm at justinfront dot net on june 2008 private function getLoadedSymbol():MovieClip { return (_loader.contentLoaderInfo.applicationDomain.getDefinition(getQualifiedClassName(_loader.content)) as Class)(_loader.content) as MovieClip; }
If you have a better approach do tell. Does Adobe think about removing unneeded hoops, loading a movie should not be so intricate.