AS3 add movie clip to stage using variable which holds the MC name

I know how to add a movie clip to the stage from the library but i'm strugling to do it when the I need to load a movie clip from the library when the name of the movie clip is held in a variable.

for(var i:Number = 0; i < 64; i++)
{
    var blueIconS:blueIcon = new blueIcon();
    addChild(blueIconS);
    blueIconS.x = 100;
    blueIconS.y = 100;
}

The above code works for adding the blueIcon but I have a variable in that loop which tells which icon to load.

sectorsMCs[jewelsIDs[i]]

The above will tell me what MC name to load but how do I load a MC from library by that variable value?

Answers


You may have to link your MovieClip to a specific class for the following to work...

 var mcName:String = sectorsMCs[jewelsIDs[i]];
 var ClassName:Object = getDefinitionByName(mcName);
 var mc:MovieClip = new ClassName();

Need Your Help

PHP send mail to multiple email addresses

php forms

What code I should do change in this PHP script to send one email to more than 20 email addresses?

Message 2100 when run sql*loader from UNIX

bash unix sql-loader

I have .sh file with the next content: