1
votes

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

2
could she not nest all that into a movieclip which can be easily repositioned ? If all the animations are in the root of the doc, she still should be able to copy all the contents (using Edit Multiple Frames) into an empty movieclip.George Profenza

2 Answers

1
votes

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!

0
votes

To answer the original question, you can access the motion tween keyframes by using frame.getMotionObjectXML() and frame.setMotionObjectXML(). This XML contains the keyframe data you are looking for (the diamond keyframes).