5 Replies Latest reply on Apr 3, 2017 2:48 AM by jlwiza1

    Copy/paste timeline frames at runtime

    abdrspock Level 1

      Well, just as the subject line implies, I need to duplicate frames within one of my movie clips, at runtime.  Nothin' fancy, just take the frame that's already in the movie clip, and make a second frame identical to the first one, also within the movie clip.  I'm using AS2.0, Flash 9.

      Here's what I'm currently trying (this code is on the main timeline, which also contains the movie clip in question):

              with (this.scoreCardPage) {
                  fl.getDocumentDOM().getTimeline().copyFrames();
                  fl.getDocumentDOM().getTimeline().pasteFrames(_root.curPage);
              }
      "scoreCardPage" is the name of the movie clip, "curPage" is the variable indicating the point on the movie clip's timeline where the copied frame should be pasted.  Please be understanding if I've horribly butchered this code; I haven't done runtime timeline manipulation before.

      Anyway, the code, she no a-work.  When I run, my movie clip maintains only the frame that I built it with, and does not gain any more.

      Internet searches pertaining to the inner workings of runtime copying and pasting of frames have been gloriously unproductive.

      Thanks for any brilliant illumination you are able to provide.

       

      }:-|

        • 1. Re: Copy/paste timeline frames at runtime
          kglad Adobe Community Professional & MVP

          can't be done.

           

          you're using jsfl code which is author-time encoding, only.

          • 2. Re: Copy/paste timeline frames at runtime
            abdrspock Level 1

            Are you saying that there is not any code that can copy and paste frames on the timeline at runtime?

             

            }:-|

            • 3. Re: Copy/paste timeline frames at runtime
              Rothrock Level 5

              That is correct. Because whatever you think you need to "copy and paste frames" for doesn't make any sense from a Flash perspective.

               

              What are you actually trying to accomplish.

              • 4. Re: Copy/paste timeline frames at runtime
                kglad Adobe Community Professional & MVP

                to reinforce rr's comment:  you can't use jsfl during runtime.  and you won't find any actionscript that manipulates objects like layers and frames.  that's strictly jsfl code.

                • 5. Re: Copy/paste timeline frames at runtime
                  jlwiza1

                  umm.. yeah you can, I always hate it when I go to coding forums and people say you can't do something when it's ********, I know this is a little late, you might not be able using AS2, but maybe.. I'm not familiar with AS2 much but definitely with AS3. Now, there are two ways that are the easiest, and you have to be hacky. First either make your movie into a swf panel, or create a swf panel that can communicate with your swf. The images in the movieclip will probably have to be converted to images pngs or jpgs, to do this at runtime, there is an excellent as3 extension library that helps with that. Basically you'd have to manage the movieclip images yourself, as your timeline, which isnt hard, you can do this however you want, I'd probably do an array with objects describing the frame something like timeline:Array = [{frame:uint, hold:uint, sourceImage:String} etc...]. When it's finished outiputting the frames grab their source through jsfl and populate your timeline accordingly.. It should take maybe 20 minutes to finish coding the thing. It's not even hard, the beauty of flash is it lets you do whatever the hell you want if you're creative enough.