Does setting properties in AS3 prevent timeline tweens?

寵の児 提交于 2019-12-01 23:24:07

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. 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.

I would stick strictly to the as3 code if I were you.

import these at the top of your actionscript

import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;

and then set your tween like this:

var myTween:Tween = new Tween(object, "property", EasingType, begin, end, duration, useSeconds);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!