[_] as3 - adding a mc from library using dynamic name
juan kennaugh
contact at jkennaugh.co.uk
Wed Dec 9 14:16:03 GMT 2009
aaaah - found this:
var classType:Class = getDefinitionByName(String("mc_animation_" +
current_animation)) as Class;
var animation:MovieClip = new classType();
looks good.
Juan
juan kennaugh wrote:
> Hi
>
> just trying to convert some as2 to as3.
>
> can you tell me how I can get this to work?:
>
>
>
> var animation_to_attach_name:String = "mc_animation_" +
> current_animation;
> var animation:MovieClip = new animation_to_attach_name();
>
> animations.addChild(animation);
>
>
> How can I instantiate my mc with a dynamically created name?
>
>
> Cheers
>
> Juan
>
>