Home Tutorials Forums Articles Blogs Movies Library Employment Press Buy templates

Go Back   ActionScript.org Forums > Extensions and Plugins > JSFL - Extending Flash

Reply
 
Thread Tools Rate Thread Display Modes
Old 08-16-2005, 01:23 AM   #1
Cerulean
Registered User
 
Join Date: May 2005
Posts: 11
Default Removing Frames b/w Keyframes

Hey there...

I am presently working on a project in which I am creating a custom JSFL file. The functionality I am looking for is that whenever I run the command a blank keyFrame will be inserted into the first frame, shifting all of the other frames over one. Then, I need to remove all of the frames that are between any keyframes so that the FLA is nothing but a series of keyFrames with a blank keyFrame in front.

I have so far gotten the blank keyFrame in and the layers shifted over one but I need a way to dynamically delete the frames in between the keyFrames, since the files that we will be editing will vary in size and setup. I have created an array that captures all of the startFrames and then lists the frameSpan but I am unable, for some reason, to remove them from the timeline. Any suggestions or advise? Here is the jsfl file that I have created so far:

ActionScript Code:
var doc = fl.getDocumentDOM(); var tim = fl.getDocumentDOM().getTimeline(); var frCnt =  tim.frameCount; var lyCnt =  tim.layerCount; // // /*   Cut all frames from the timeline so I can   insert a blank key frame in the first frame - jbm */ // tim.selectAllFrames(); tim.cutFrames(); tim.currentLayer = 0; for (var j=0; j<frCnt; j++) {     tim.selectAllFrames(0,frCnt);     tim.removeFrames(0,frCnt);     tim.currentLayer += 1; } // /*   Create a 'Stop' action for the first frame   Label first frame 'Blank Frame'   Paste Frames at layer index 0 frame index 1 - jbm */ // tim.currentLayer = 0; tim.addNewLayer(); tim.insertBlankKeyframe(0); tim.layers[0].frames[0].actionScript = 'stop();'; tim.setFrameProperty('name', 'Blank Frame'); // // tim.currentLayer = 0; tim.pasteFrames(1); // var lyCnt02 = tim.layerCount; var frCnt02 = tim.frameCount; /*   Rename all layer "New Layer" plus their index number   ie: New Layer 0, New Layer 1, etc...  - jbm */ // tim.currentLayer = 0; for (var i=0; i<lyCnt; i++) {     for (j=0; j<n; j++) {         var curLayer = tim.currentLayer;         var curFrame = tim.currentFrame;         var frameArray = tim.layers[curLayer].frames;         var n = frameArray.length;         var frameSpan = tim.layers[curLayer].frames[curFrame].duration;         var stFrame = frameArray[j].startFrame;         var delFrame01 = stFrame + 1;         var delFrame02 = delFrame01 + 1;         fl.trace(lyCnt02);         if (j==stFrame) {             fl.trace("Keyframe at: " + j);             fl.trace("Duration of " + frameSpan +  "frames");             tim.setSelectedFrames(delFrame01);             tim.removeFrames(delFrame01, delFrame02);             }         }            if (lyCnt02>lyCnt) {             for (var k=0; k<lyCnt02; k++) {                 var curLayer = tim.currentLayer;                 var delLyr = lyCnt;                 tim.currentLayer = delLyr;                 tim.deleteLayer(delLyr);                 }         }     tim.layers[curLayer].locked = true;     tim.currentLayer += 1;     tim.currentFrame += 1; }
Cerulean is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:20 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2009 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.