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:

// 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">
         <SimpleEase ease="0"/>

   <Keyframe index="34">
         <Color alphaMultiplier="0"/>

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;

var FADE_OUT_animator:Animator;

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

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?

  1. crawlers says:

    though i am not a programmer, couldn’t one do some debugging and undo the flippling by making it flip again after the code has flipped it?

    i also suggest that one does not follow the above untill one runs out of other ideas

    Hot debate. What do you think? Thumb up 2 Thumb down 6

  2. Poethemonk says:

    Is there an Adobe forum where you can ask for help?

    I would assume that if there is an Adobe forum that there is probably someone who knows the “better and correct” way.

    Thumb up 4 Thumb down 1

  3. Alex says:

    Ummm… I… I don’t really… uhhh… I only speak English…

    Hot debate. What do you think? Thumb up 5 Thumb down 6

  4. Gingusa says:

    The Music for ths game hasent worked for me for like more than a year :/ i usually just use pandora

    Thumb up 2 Thumb down 3

  5. percyjnorus says:

    im not a programmer but i love your games and i would love it if you would make another gunmaster game they are the bomb!
    thanks one of your best fans

    Thumb up 1 Thumb down 3

  6. It seems as though it flips after the step which means it may not be looping. u may want to look up the var.scalex property and see if it changed between the versions or if the compiling is different. if the scale changed then u should just modify it, but if the compiling changed then u should see why and how. i dont know either 3, nor 5.5, i used cs4

    Thumb up 1 Thumb down 2

  7. samuk says:

    Hidden due to low comment rating. Click here to see.

    Poorly-rated. Thumb up 1 Thumb down 11

  8. Jakeomaniac says:

    I honestly have no clue. Perhaps they changed what “-1” is (maybe to the same size, but opposite facing…), but I’m just making a shot in the dark here… I really can’t tell. Sorry.

    Thumb up 0 Thumb down 3

    • Jakeomaniac says:

      Just took a closer look at what was happening, and I’m still making something of a random guess, but try this:

      clip.scalex = 1

      I might be tripping here, but maybe they changed it so it relates to the relative position and orientation of the clip, rather than the overall position and orientation. As in:

      s = size of clip
      n = value of clip.scalex
      o = resulting size of clip

      n * s = o

      If this is the case, the size would be stretched by a factor of “n”, and negative values would mirror the clip, then stretch it…

      Thumb up 2 Thumb down 2

Leave a Reply

Your email address will not be published. Required fields are marked *