Question

How do you automatically convert all items of Movie Clip (SymbolItem) in the library that uses Classic Tween to key frames?

enter image description here

enter image description here

Was it helpful?

Solution

You can use this JSFL script, supported in Adobe Flash Professional CS4 and later

Documentation can be found here: http://help.adobe.com/en_US/flash/cs/extend/index.html

var document = fl.getDocumentDOM();

var library = document.library;

for (var libraryItemIndex in library.items) {
    var libraryItem = library.items[libraryItemIndex];

    fl.trace(libraryItem.name + " is " + libraryItem.itemType);

    if(libraryItem.itemType == "movie clip") {

        fl.trace(" processing movie clip");

        library.selectItem(libraryItem.name);
        library.editItem(libraryItem.name);

        var timeline = libraryItem.timeline;

        fl.trace(" contains " + timeline.layerCount + " layers");
        fl.trace(" selected layers " + timeline.getSelectedLayers());

        for (var layerIndex in timeline.layers) {
            fl.trace(" trying to select layer " + layerIndex);
            timeline.setSelectedLayers(Number(layerIndex));
            fl.trace(" converting to key frames");
            timeline.convertToKeyframes(0, libraryItem.timeline.frameCount - 1);
        }
    }
    else {
        fl.trace(" ignoring");
    }
}

Output will look like this:

enter image description here

Note: watch out for method timeline.setSelectedLayers(), cast to Number is neccessary

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top