1

I'm writing a jsfl script to export animations in Flash CS6 to a format we desired. Here's the problem, as we used motion tween for animation, we can correctly get position, rotation and scale of the element using the following code. However the code cannot work with color information:

var element = something;
for( var frameIndex = 0; frameIndex < layer.frames.length; frameIndex++ )
{
    timeline.currentFrame = frameIndex;
    fl.trace( element.x + ", " + element.y );             // Works
    fl.trace( element.scaleX + ", " + element.scaleY );   // Works
    fl.trace( element.rotation );                         // Works
    fl.trace( element.colorAlphaPercent );                // DOES NOT WORK
}

We did a simple animation that the element's alpha changes from 0 to 100, linear. As we print out all the colorAlphaPercent value from start to end, turns out that it's all 0. We tested more and discovered that no matter what animation you make, on any frame, the colorAlphaPercent value always equals the value on the first frame. The same thing happens on colorAlphaAmount and other color values (red, green, blue).

The only way we can get rid of this is to do the Convert to frame by frame animation on the motion tween. But that break up one element into many of them, so that I can't tell if they are originally the same element.

So... is there anyone know how to get the color information from an element within a motion tween? Thanks anyway :)

2
  • I've ran into the same issue a while ago. I ended up writing my own algorithm that reads and interpolates the alpha values between the start and end frame of a motion tween. Here's my question & answer in case that helps: stackoverflow.com/questions/14280834/… Feb 12, 2013 at 3:09
  • Thanks @bigp, I ended up with parsing the xml from frame.getMotionObjectXML(), and interpolating it. It makes the script running really slow, but works. Thanks for your MathUtils class, I can use it somewhere else :D
    – Peter Ren
    Feb 13, 2013 at 5:26

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.