15 Replies Latest reply on May 9, 2008 1:08 PM by CHAOS'|nc.

    Deleting alternate frames from the timeline

    HamptonCaught Level 1
      Hi

      I have a movie which is made up of individual frames (like an old style cartoon animation), whereby each frame moves on a bit from the previous one and when viewed in Flash, looks like a movie.

      I want to remove some of the frames - probably every other frame to make the file size smaller. I can't find a way of doing this easily. I can select alternate frames using the 'Apple' key, but if I then go to Edit>Timeline>Remove frames or >Clear frames, it doesn't actually remove the frames I've highlighted.

      Am I missing something?

      Many thanks for any help.
        • 1. Re: Deleting alternate frames from the timeline
          Ned Murphy Adobe Community Professional & MVP
          Remove frames is what you are after.

          There probably isn't a way of doing it easily... I don't think you can pick individual frames that are separated and have Flash agree to remove them all at once... either remove one frame at a time, or slide the frames you want to keep over to the left one at a time and then delete the group of them that remains at the end.

          Here's the good news (maybe)... often, when I say something like this, someone who knows more than I do and knows a way might be driven to step in and give you (and me) the information you are hoping to get.
          • 2. Re: Deleting alternate frames from the timeline
            HamptonCaught Level 1
            Thanks for your reply Ned.

            Let's hope you're right - that someone can enlighten both of us. And if it's not easy to achieve, I would say that it's something Adobe should certainly look at for future upgrades. It seems a fairly basic thing to want to achieve to me.

            By the way, I should have said in my first post that I'm using Flash CS3 (v 9.0).
            • 3. Deleting alternate frames from the timeline
              clbeech Level 3
              yeah - you can select the frame or group of frames in the timeline by clicking a dragging vertically - horizontally or both. say if you wanted to select all frames on multiple layers at frame 20 click and hold on the top most layer frame, drag down to the lowest and release - then with those frames selected right_click (or ctrl click for Mac if you don't have a dual button mouse) anywhere on the frames selected, then select 'remove frames' from the list. the frames will be removed and all other frames will move to the left.
              • 4. Deleting alternate frames from the timeline
                FlashKitty Level 1
                You will need to make a command.

                In Flash CS3 select a new JSFL file. Then add this code: (note:code is not tested, might contain typos)

                var frmCount = fl.getDocumentDOM().getTimeline().layers[0].frameCount;
                var curTimeLn = fl.getDocumentDOM().getTimeline();
                var curFrame = fl.getDocumentDOM().getTimeline().currentFrame;
                var stFrame = curFrame;

                for (i=0; i < (frmCount - stFrame)/2; i++) {
                curTimeLn.removeFrames(curFrame);
                curFrame += 2;
                }

                The top section is just variables to make the code easier to write. The for loop simply goes through the timeline starting at the frame you have selected and deletes it and then moves two frames and runs again (deleting that frame) until it has reached the end of the timeline.

                Save this file with whatever name you wish to call this command ('twoFrame Remover'?), in your commands folder.

                C:\Documents and Settings\...your logon here...\Local Settings\Application Data\Adobe\Flash CS3\en\Configuration\Tools\commands

                After saving it, you should find it in your commands drop down menu item.

                If this does not remove the frames the way you want, you can simply undo the command and fix the code as you need it. If you know the number of frames you want removed, you can simply hard code the number instead of going all the way to the end of the timeline. Of course you will have to change the command every time you want to use it. But it is easy to play around with it and get what you want out of it. You can easily remove every 3rd frame, or 4th frame etc. Just adjust the code and save it.

                Hope that helps.
                • 5. Deleting alternate frames from the timeline
                  Ned Murphy Adobe Community Professional & MVP
                  The information you provided is about making your own commands is good to know.

                  The only potential problem that might come of the example you gave is that it might end up removing frames that are desirable to keep. My only reason for saying that is based on assuming the removals start at the low end of the frame numbers. I guess it depends on what the status of the current frame is after it is removed. If the next frame assumes the current frame position before the next removal, then the next current frame (ala curFrame += 2) would be one of the keepers.

                  It might be safer to start at the far end of the timeline and work backwards so that the removable frames are always 2 steps down the line where nothing shifts places in the direction you're travelling.
                  • 6. Re: Deleting alternate frames from the timeline
                    FlashKitty Level 1
                    the currentFrame property of the timeline object is just an integer (the index to the frame), it doesn't actually move the playhead, so all you are doing is increasing the value of the integer (index to the frame). Again, I haven't tested it, but it shouldn't be a problem.

                    • 7. Re: Deleting alternate frames from the timeline
                      clbeech Level 3
                      i don't see a need to construct a command for this - and this method seems quite dangerous to employ when dealing with a hand keyframed animation.
                      • 8. Deleting alternate frames from the timeline
                        Ned Murphy Adobe Community Professional & MVP
                        Your first reply reflected you didn't understand what HamptonC is trying to do, but maybe you have another idea that can help out. HamptonC isn't trying to remove a group of adjacent frames, but is trying to remove frames that are separated by frames HamptonC wants to keep--but doesn't want to have to do each frame one at a time. Let's say there's one layer in the timeline... HamptonC wants to remove frames 2, 4, 6, etc.... all the way down the line.

                        I was faced with this at one time for the exact same reason HamptonC wants to remove some frames, to reduce filesize, but I ended up doing it one frame at a time since I couldn't select frames that weren't adjacent. Apparently HamptonC can select indivdual/separate frames, but it still won't do the removal of the selected frames.
                        • 9. Re: Deleting alternate frames from the timeline
                          clbeech Level 3
                          actually Ned - I do understand perfectly - and also know that both methods will work. If you select a frame - hold down command (mac) or control (pc) and select multiple frames - then right-click (pc) or control-click(mac) - ONE OF THE FRAMES SELECTED - and select 'remove frames' from the list OR use the Edit>Timeline>remove frames command - all frames selected will be removed, and the timeline will be consolidated.

                          AND i would stress that if you've ever done any keyframed animation - it is highly unlikely that the frames you wish to remove will all be of an even incrementation. The OP states: "I want to remove some of the frames - probably every other frame..." <-- probably.

                          Also - you're reply doesn't reflect that you'd noticed the post numbers of myself or the OP - since it's likely that I do know what I'm talking about, and it's also likely that the OP may not have as much experience.
                          • 10. Re: Deleting alternate frames from the timeline
                            FlashKitty Level 1
                            This is NOT dangerous. A simple undo from the History panel will restore everything back. If HamptonCaught wants something more sophisticated than every 2 or every 3 frames etc., then there is no reason for his question. If there is no pattern, then it HAS to be done by hand.
                            • 11. Re: Deleting alternate frames from the timeline
                              HamptonCaught Level 1
                              Thanks for all your replies.

                              cbeech - if I've understood your method correctly (and apologies if I haven't), then it's not working for me. All of the frames I wish to delete are in one layer and they are alternate frames (2, 4, 6, 8 etc. etc.).

                              I manually selected all the frames I wanted to delete using the 'Apple' key and then using the 'Control' key went to 'Remove frames'. It removed frames, but not the ones I wanted - when I played the movie back, it was obvious that the process simply hadn't worked.

                              I'll try FlashKitty's code option, which looks interesting (although it still seems to me that this is something that should be fairly easily achievable with the keyboard).

                              Thanks again for all your help.
                              • 12. Re: Deleting alternate frames from the timeline
                                HamptonCaught Level 1
                                There's a syntax error with FlashKitty's code which I'm currently trying to figure out (ActionScript is not one of my strong points).

                                Any help greatly appreciated !!
                                • 13. Re: Deleting alternate frames from the timeline
                                  FlashKitty Level 1
                                  HamptonCaught,

                                  I just tried the code. I cut and paste from this forum and It seemed to work fine. I didn't check for every frame, but my timeline was about half the size of the original after it ran.

                                  Make sure you follow the directions and put this in a flash javascript file (i.e. open a flash javascript file not an actionscript file). If you are using a Mac I'm nost sure if it is stored differently than on a Windows XP machine, but that is where the code needs to go. If you save it in Flash it should put the jsfl extension on it correctly.

                                  Let me know if you have any problems.
                                  • 14. Re: Deleting alternate frames from the timeline
                                    FlashKitty Level 1
                                    I see now that I have the wrong folder location.

                                    instead of

                                    C:\Documents and Settings\...your logon here...\Local Settings\Application Data\Adobe\Flash CS3\en\Configuration\Tools\commands

                                    It should be

                                    C:\Documents and Settings\...your logon here...\Local Settings\Application Data\Adobe\Flash CS3\en\Configuration\Commands

                                    If the file is not saved in the correct folder, it won't show up on the commands menu.
                                    • 15. Re: Deleting alternate frames from the timeline
                                      CHAOS'|nc. Level 1
                                      Can't you simply drag vertically or horizontally? What kitty said is quite useful actually if you have a standard group of frame.