flashflash-cs5jsfl

JSFL: how to access Motion Tween keyframes in Adobe Flash CS5?


our animator created a very complex movieclip in Adobe Flash CS5, containing 50+ layers, motion tweens and 3D tweens. Unfortunately, she placed all elements 680 pixels too far to the right and 400 pixels too far down.

We're trying to find a way to move all elements on all layers without breaking the animations. We tried a JSFL script called "MoveRegpoint", but it does not handle the Motion Tween keyframes (diamonds) properly. So now I am trying to write a JSFL myself.

How can I determine if a frame is a Motion Tween and if the frame is a keyframe? See the current script:

// get the selected Element
var vElement = fl.getDocumentDOM().selection[0];

// get the Timeline of the Element
var vTimeline = vElement.libraryItem.timeline;

// loop over the Timeline's Layers
var vLayersLength = vTimeline.layers.length;
for (var i=0; i<vLayersLength; ++i) {
    var vLayer = vTimeline.layers[i];

    // loop over each Layer's Frames
    var vFramesLength = vLayer.frames.length;
    for (var j=0; j<vFramesLength; ++j) {
        var vFrame = vLayer.frames[j];

        if(vFrame.isMotionObject()) {
            // DOES NOT WORK, startFrame is always 0
            if(vFrame.startFrame == j) {}
        }
    }    
}

To be clear: frame.startFrame is always 0 because the Motion Tween starts at frame 0. There are diamonds at frame 12, 27 and 49 that define the motion. I want to know if a frame contains a diamond and access the data in these diamonds.

Paul


Solution

  • There's a flash extension that does this perfectly called New Anim Clip - you can find it on Toon Monkey: http://toonmonkey.com/extensions.html

    I use it all the time by: -Selecting all the frames I want to in my new clip (over multiple layers), then clicking Cut Frames from the timeline right-click menu -clicking the NewAnimClip command -naming a new symbol and layer with something descriptive -click in the first frame of the new clip and Paste Frames

    Voila! A new clip that you can resize and reposition, aligned to the original timeline!