zindex and play()
I've looked on Google for a solution for this and was unable to find anything, or I'm just not using the correct terminology, so any help would be appreciated.
I've noticed that when using a depth altering method such as swapChildren along with some sort of play() method, that the swapped mcs are copied on the stage and their timeline begins playing. the swapped mcs are both mcs inside an mc.
// swapChildren() is executed first, then play()
// Any other time play() is used the bug does not show up
private function charDirection(currentKey:uint):void
{
if (currentKey != _previousKey)
{
_previousKey = currentKey;
this.scaleX *= -1;
trace(this.numChildren);
this.swapChildren(mainChar_shield, mainChar_spear);
}
}
private function walkingLoop():void
{
if (currentLabel != "Walking")
{
gotoAndPlay("Walking");
} else {
play();
}
}
mainChar_shield is an mc inside mainChar mc.
I've also been told that you shouldn't change the zindex of an mc that's been instantiated by the timeline. So I'm wondering if there's another way to do this or some hack around it.
Thanks