Copy Motion as Actionscript 3.0 and fl.motion.Animator Bug?

I ran into an issue recently when transitioning from CS3 to CS5.5 when using XML stored motions. The issue involves XML animation code and the fl.motion.Animator class. This is the reason behind some of the recent animation issues found in Bowmaster Winter Storm after moving form CS3 to CS5.5. If you’re a Flash developer please read and tell me what you think.

In Bowmaster Winter Storm I use Flash’s “Copy Motion as Actionscript 3.0” which was a feature introduced in CS3. It copies the Motion Tween information (Classic Tween for CS5) as XML and then you use an instance of fl.motion.Animator class to apply that tween animation to any DisplayObject instance you want. This is a great way to dynamically apply special effects to MovieClips without having to manually copy animation effects on the timeline. This is the tech behind some of the special death effects you see when game characters die (for example, from being struck by lighting and turning to smoke, or getting hit by poison and have their flesh melt away leaving only the bone structure).

So the issue I’m having is that with CS5 and CS5.5 the animation behavior seems to have changed from CS3 even though the code has stayed the same. Below are examples of three different swf files all using the same code. The only difference is which version of the Flash IDE was used to publish each swf.

Get Adobe Flash player

Get Adobe Flash player

Get Adobe Flash player

As you can see. The first animation behaves as desired. The MovieClip retains it’s orientation (scaleX == -1 is preserved) when the animation tween is applied.

For the next two animations using CS5, the scaleX value is reset back to 1.

At first I thought it was an issue with the targetted flash player. So the second animation demonstrates targeting Flash Player 9 using CS5. Despite this, the clip still flips.

Here is the code that is used for all three versions:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// main timeline code at frame 1
import fl.motion.Animator;
var FADE_OUT_xml:XML = <Motion duration="35" xmlns="fl.motion.*" xmlns:geom="flash.geom.*" xmlns:filters="flash.filters.*">
   
   <Keyframe index="0" tweenSnap="true">
      <tweens>
         <SimpleEase ease="0"/>
      </tweens>
   </Keyframe>

   <Keyframe index="34">
      <color>
         <Color alphaMultiplier="0"/>
      </color>
   </Keyframe>
</Motion>;

var clip:MovieClip;

clip = new LibClip(); // LibClip is defined in the Library with linkage id (class name) LibClip -- this is the clip seen on screen with black rectangles
clip.x = 200;
clip.y = 300;
clip.scaleX = -1;
addChild(clip);

var FADE_OUT_animator:Animator;

// called on frame 30
function playAnim():void
{
   FADE_OUT_animator = new Animator(FADE_OUT_xml, clip);
   FADE_OUT_animator.play();
}

Download Source

In summary, for better or worse there is no denying that using the same code but with different Flash IDEs we see different animation behavior. Perhaps the Flash CS3 implementation of Animator was bugged and Adobe fixed it in CS5 or it worked in CS3 and a bug was injected into CS5. Either way, I’ve found no discussion of a change in functionality to the Animator class in the Adobe AS3 reference documentation.

Can any fellow Flash developers out there point me to any more information about this subject? Is there a bug database that I could look at to possibly find more information?

My concern is that even though I’ve figured out a work around to “migrate” my code to get the functionality I desire using CS5, if I change my code and it was a new bug, then what happens when Adobe fixes the bug? Will the functionality change all over again?

If you’re a Flash developer and have had to deal with this issue, what is your take? Which is the correct animation behavior? CS3 or CS5. Obviously I learned to get used to the CS3 behavior but this is not to say that it’s the right way. But consider this: why would the scale property change if the animation xml does not explicitly state to tween the scale property? Shouldn’t all properties not mentioned in the xml retain their original value while only those explicitly mentioned get modified?

Bookmark the permalink.

9 Responses to Copy Motion as Actionscript 3.0 and fl.motion.Animator Bug?