Copy link to clipboard
Copied
Hi, I'm having trouble with the following function:
private function whichLevelToLoad():void{
if(levelToLoad == "nothing"){
currentLevel = null;
}
var thisObj:Object = new Object();
if(levelBtnArray!=null){
for(var j:int=levelBtnArray.length-1;j>=0;j--) {
if(levelToLoad == String("level " + (j+1))){
thisObj["level"+(j+1)] = new ["Level"+(j+1)]();--------------------------->The Problem
thisObj["level" + (j+1)].x = 0;
thisObj["level" + (j+1)].y = 0;
addChildAt(thisObj["level" + (j+1)], 0);
currentLevel = thisObj["level" + (j+1)];
}
}
}
}
I'm trying to instatiate 75 objects by using a loop. The line would look like this,"thisObj.level1 = new Level1(); with the numbers going from 1-75. Is this possible? How
do I do it?
Thank you....
getDefinitionByName solves this problem.
Copy link to clipboard
Copied
getDefinitionByName solves this problem.
Copy link to clipboard
Copied
thanks a lot.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now