[HELP] How to use getDefinitionByName?
What I'm essentially trying to do is turn movieclips into spritesheets of themselves, showing all positions of their rotations. I can do this for one MC, but I'm having trouble scaling it up to work on multiple ones.
Here's (the top of) my code:
PHP Code:
import flash.utils.getDefinitionByName;
var i:int = 0;
var myMCs:Array = ["Test", "Test2"];
var c:MovieClip;
for (i=0; i<myMCs.length; i++) {
c = getDefinitionByName(myMCs[i]) as MovieClip;
addChild(new c());
}
The problem appears to be with the line addChild(new c());.
It should, in theory, take the list of classes inside myMCs and create an instance of each of those classes.
In other words, I want to dynamically add movie clip instances of Test and Test2 (plus any other ones I add later) to the displayList.
The error I get when I try to compile (btw this is in the Flash authoring environment) is:
1180: Call to a possibly undefined method c.