I have a class which extends a SWC , in the swc i have two boxes, front and back and an animation on the same timeline. The animation works fine without swapping when I swap them the animation stops working. Anyway I can make it work?
I have the following code :
var frontTemp:DisplayObject = this.animationInstance.getChildByName("front");
var backTemp:DisplayObject = this.animationInstance.getChildByN开发者_StackOverflow中文版ame("back");
this.animationInstance.swapChildren(frontTemp,backTemp);
this.animationInstance.gotoAndPlay("animation");
The short answer is, you should avoid using both frame animations and scripts on the same objects. Basically, frame animations and scripts are two different ways to control the properties of clips (position, size, stacking order, etc). And if you use them both, Flash has no unambiguous way to know which set of instructions should take precedence. The way Flash deals with this problem is, once you use scripts to update something, it is no longer affected by frame animations from then on (unless it gets removed from the stage and re-added).
I posted a couple of general ways to fix this kind of issue in answer to this question - please have a look.
精彩评论