I’m loading a bunch of tiles for a tile game and just decided to rewrite the whole game in AS3 instead of AS2. I just want to add my library tiles named from “mc1”-“mc15” to my patch mc and place them on the stage! What am I doing wrong? And can I skip an if/switch at the end deciding which tile to fetch from the library? :cantlook:
I’m not getting any error messages… it’s just that nothing shows up
Here’s the code!
public function placeTiles(X:Number,Y:Number) {
k=0;
for (var j:uint = 0; j<=finito; j++) {
for (var i:uint = 0; i<=finito; i++) {
xy=arrObj["arr"+j]*;
if (xy==0) {//Random tile
whC = "mc"+(Math.round(4*Math.random()+14));
if (whC=="mc14") {//Correct probability
whC="mc18";
}
} else {
whC="mc"+xy;
}
var patch:MovieClip = new MovieClip();
fetchTile(whC);
patch.addChild(fetched);//DOES IT EVEN LOAD?
patch.name="tile"+k;
patch.x=-25-finito*25+50*i;
patch.y=-25-finito*25+50*j;
patch.myX = (X-(finito/2))+i;
patch.myY = ((finito/2)+Y)-j;
patch.TYPE=xy;
addChild(patch);//I CAN'T SEE IT
trace(["tile"+k]);
k++;
}
}
}
public function fetchTile(whC:String):MovieClip {//CAN I SKIP THIS IN SOME WAY?
if (whC=="mc3") {
fetched= new mc3();
} else {
fetched= new mc15();
}
return fetched;
}
}