TwelvestoneFlash

getLoadedSymbol()?


Sign in

  • Waiting for Godot ( 730 k posts )
    Just conversation.
  • Thunder Dome ( 23 k posts )
    Photoshop Tennis and Collabs.
  • Photography ( 5.1 k posts )
    For all you shutterbugs, sh...
  • Flash ( 18 k posts )
    ActionScripting to tweens, ...
  • Front End ( 5.9 k posts )
    general front end design an...
  • Back End ( 9.7 k posts )
    serverside scripting, progr...
  • Projects and Theory ( 12 k posts )
    This forum is for discussio...
  • FAQ ( 269 posts )
    All those nagging questions...
  • Design ( 17 k posts )
    graphics & all aspects of g...
  • Purgatory ( 3.6 k posts )
    12stone Jail, feel free to ...
JLM
 
2008-06-24

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.

Sorry, you must be a member to post to a conversation. Either log in or sign up to get involved.
TwelvestoneFlash

getLoadedSymbol()?