views:

286

answers:

2

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?

A: 

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);
Trip
+1  A: 

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