I have my background added in the first world of my platform based game like this:
else if (lvlArray* == 'ROCKYHILLS') {
var newRockyHills:backRocky = new backRocky;
newRockyHills.x = newRockyHills.width / 2;
newRockyHills.y = newRockyHills.height / 2;
//newRockyHills.scaleX *= 1.2;
currentStage.addChild(newRockyHills);
currentStage.setChildIndex(newRockyHills, 0);
}
Next i want to add the new background, so i wrote this:
else if (lvlArray* == 'FIERYPITS') {
var newFieryPits:bgFieryPits = new bgFieryPits;
newFieryPits.x = newFieryPits.width / 2;
newFieryPits.y = newFieryPits.height / 2;
//newRockyHills.scaleX *= 1.2;
currentStage.addChild(newFieryPits);
currentStage.setChildIndex(newFieryPits, 0);
currentStage.setChildIndex(newRockyHills, 1);
}
But it doesn’t work. How can i change the order and put the new Bg on top?