Dynamically creating movieclips in AS3

Hi-

I’m currently making the jump from AS2 to AS3, and wondering about how to do a dynamic movieclip creation in AS3, that used to be easy in AS2.

Let’s say you are creating an mc which you’d like to create at runtime- for instance you have a bunch of different animation mc’s, and you don’t know which one you will need until runtime. In AS2, you could handle this case as follows:

var new_mc = attachMovie(desired_anim_linkage, “new_mc”, …);

where ‘desired_anim_linkage’ is the linkage id of the mc you want to create- this is just a string that can be built however you like, on the fly.

In AS3, we are now forced to use the ‘new’ operator to create our MC’s as far as I know:

var new_mc = new MyAnim();

So the question is- how can we make the call to ‘new’ dynamic? In other words I’d like to do something lilke:

var myDesiredAnim = “MyAnim”;
var new_mc = new myDesiredAnim;

of course this won’t work, but hopefully it explains what I’m after… :goatee:

Thanks