开发者

Animation stops working after swapping

开发者 https://www.devze.com 2022-12-30 12:16 出处:网络
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 w

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消