在 AS3 中设置属性是否会阻止时间线补间? [英] Does setting properties in AS3 prevent timeline tweens?

查看:14
本文介绍了在 AS3 中设置属性是否会阻止时间线补间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我有一个为其分配了类的影片剪辑,并且我在代码中更改了该影片剪辑的属性,则该属性似乎无法再在时间轴上进行补间.

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.

例如,如果我的类设置 this.x = 100,然后在时间轴上我补间对象的位置,则不会发生该时间轴补间.

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.

更改 scaleX 或 scaleY 属性似乎也会阻止时间线补间的发生.

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?

推荐答案

你说得对.更改舞台上 MC 的某些属性将导致 Flash 假定您将使用脚本定位它,并且补间将不再起作用.一些解决方法:

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:

  1. 重新定义内容,以便将脚本定位和 IDE 定位分开.也就是说,如果您在补间对象的 X 位置并使用脚本旋转它,请更改它,以便您补间容器剪辑的 X,并在内部旋转内部剪辑.
  2. 使用脚本完成所有定位 - 即使用 Tween 类或 tween 库.
  3. 如果播放头经过剪辑不在舞台上的帧,然后到达它所在的帧,这将重置"剪辑以使用 IDE 定位和补间.即使您使用 gotoAndPlay 跳过空帧也是如此.因此,例如,如果您使用脚本在第 10 帧移动剪辑,然后在第 20 帧执行 gotoAndPlay(30);,那么如果您输入空白,第 30 帧的补间将正常工作帧介于第 20 帧和第 30 帧之间.
  1. Reparent things so that you separate scripted and IDE positioning. That is, if you were tweening an object's X position and also rotating it with script, change it so that you tween the X of a container clip, and rotate an inner clip inside.
  2. Do all your positioning with script - i.e. use the Tween class, or a tween library.
  3. If the playhead goes past a frame where the clip is not on the stage, and then to a frame where it is, this will "reset" the clip to work with IDE positioning and tweens. This is true even if you jump past the empty frame with gotoAndPlay. So for example, if you use script to move the clip on frame 10, and then on frame 20 you do gotoAndPlay(30);, then a tween at frame 30 will work correctly if you put a blank frame somewhere between frames 20 and 30.

这篇关于在 AS3 中设置属性是否会阻止时间线补间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆