Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

action script 3, problem with swapChildren and setChildIndex

New Here ,
Jul 02, 2014 Jul 02, 2014

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!!!

TOPICS
ActionScript
236
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jul 02, 2014 Jul 02, 2014

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;

}

}

Translate
Community Expert ,
Jul 02, 2014 Jul 02, 2014

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;

}

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 03, 2014 Jul 03, 2014

THANKS MAN!!! that is right, i just had to remove the fighters before changing the scene!! THANKS A LOT !!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 03, 2014 Jul 03, 2014
LATEST

you're welcome.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines