Search code examples
apache-flexactionscriptloadermovieclip

Can I control multiple instances of movieclips in a loaded swf at once?


I am loading an swf created in flash professional cs5 via the loader class into a flex 4.1 application. The flash file contains multiple movieclips that are exported for actionscript and those movieclips exist in many instances throughout the movie.

Iterating through everything, comparing class types seems to be the most easy but also the most redundant way to solve this. Is there any way of using the class name as a kind of global selector to access the clips?

I could also make the sub-clips in the flash listen for an event on which they perform an action, but I am not really sure what might be best.


Solution

  • i guess typing it out did the trick. i used the event solution:

    in the root timeline i placed a function like this:

    function cause():void {
        dispatchEvent(new Event("do stuff",true));
    }
    

    and in the library clip's main timeline goes:

    DisplayObject(root).addEventListener("do stuff", function (e:Event=null) {
        ... whatever ...         
    });
    

    this is dirty but you get the idea.