AS3 importing from library
Hi guys, does anyone know if it's possible to use variables to call objects from your library onto stage like this:
I have an object in my library called Level01 as is it's linkage
Actionscript Code:
var MyMap:String = "Level01";
addEventListener(Event.ENTER_FRAME,LoadMap);
function LoadMap(event:Event) {
var myLVL:MovieClip = new MyMap();// how do you use the variable here?
this.addChild(myLVL);
myLVL.x = 0;
myLVL.y = 0;
removeEventListener(Event.ENTER_FRAME,LoadMap);
}
if i call it directly using:
Actionscript Code:
var myLVL:MovieClip = new Level01();
it works fine but i want to use variables to call the correct object.
Any Ideas?