Copy link to clipboard
Copied
hello there everyone!!! i am making a fighting game in action script 3, and i am having a problem with swapChildren and setChildIndex. the case is that the last fighter that attacked gets in front of the other so i use swapChildren(fighter_1,fighter_2).
While the fight is going on it works alright, but when the fight ends and i change the scene the two fighters that swaped depths during the fight still appear on the stage!! its like they have been duplicated!! does anyone have a solution ? thanks in advance!!!
to remove a displayobject and possibly null it, call removeF:
function removeF(dobj:DisplayObject,nullBool:Boolean):void{
if(dobj.stage){
dobj.parent.removeChild(dobj);
}
if(nullBool&&dobj){
dobj=null;
}
}
Copy link to clipboard
Copied
to remove a displayobject and possibly null it, call removeF:
function removeF(dobj:DisplayObject,nullBool:Boolean):void{
if(dobj.stage){
dobj.parent.removeChild(dobj);
}
if(nullBool&&dobj){
dobj=null;
}
}
Copy link to clipboard
Copied
THANKS MAN!!! that is right, i just had to remove the fighters before changing the scene!! THANKS A LOT !!
Copy link to clipboard
Copied
you're welcome.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now