Search code examples
actionscript-3nestedloadermovieclip

AS3 access to properties of movieclip loaded in dynamically


My movieclip clipArt_mc receives movieclips that are loaded dynamically from a listbox selection using:

var myLoader9:Loader = new Loader();  

I apply color to clipArt_mc using the following:

 var trans3:Transform = new Transform(MovieClip(parent).design_mc.clipArt_mc);

I would like to access the nested or loaded in movieclip inside of clipArt_mc that has in it a movieclip named color_mc so that I can apply color directly to it instead of clipArt_mc.

Can this be done?

Thank you in advance for your time. Anne


Solution

  • There are a few ways you can try to get the child MovieClip. In your case, it sounds appropriate to try to get the child by name. If the situation is as you say, you should be able to do this:

    var child:DisplayObject = clipArt_mc.getChildByName(color_mc);
    

    You can then apply the relevant transform to child.