在 AS3 中设置属性是否会阻止时间线补间?
如果我有一个分配有类的影片剪辑,并且我在代码中更改了该影片剪辑的属性,则该属性似乎无法再在时间轴上进行补间。
例如,如果我的类设置 this.x = 100,并且稍后在时间轴上补间对象的位置,则不会发生该时间轴补间。
更改scaleX或scaleY属性似乎也会阻止时间线补间的发生。
有其他人经历过这种情况吗?如果是的话,有没有办法解决?
If I have a movieclip that has a class assigned to it and I change a property of that movieclip in code, it seems that the property can no longer be tweened on the timeline.
For example, if my class sets this.x = 100, and later on the timeline I tween the position of the object, that timeline tween will not occur.
Changing either scaleX or scaleY property also seems to stop timeline tweens from happening.
Has anyone else experienced this, and if so, is there a way around it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你说得对。 更改舞台上 MC 的某些属性将导致 Flash 假定您将使用脚本来定位它,并且补间将不再起作用。 有几个解决方法:
gotoAndPlay
跳过空帧也是如此。 例如,如果您使用脚本在第 10 帧上移动剪辑,然后在第 20 帧上执行gotoAndPlay(30);
,那么如果您放置空白,则第 30 帧处的补间将正常工作帧位于第 20 帧和第 30 帧之间。You have it right. Changing certain properties of an MC on the stage will cause Flash to assume that you are going to position it with script, and tweens will no longer work. A couple of workarounds:
gotoAndPlay
. So for example, if you use script to move the clip on frame 10, and then on frame 20 you dogotoAndPlay(30);
, then a tween at frame 30 will work correctly if you put a blank frame somewhere between frames 20 and 30.如果我是你,我会严格遵守 as3 代码。
将它们导入到动作脚本的顶部
,然后像这样设置补间:
I would stick strictly to the as3 code if I were you.
import these at the top of your actionscript
and then set your tween like this: