11 Replies Latest reply on Oct 29, 2009 4:46 AM by Henk @ Villa

    export problems multiple movieclips to image sequence

    Henk @ Villa

      For our customer we made several flash animations. My output has to be image sequences for Cinemascope format. The export function in Flash for image sequences does not work! All my images are the same frame. This is frame 0 on the timeline. So the embedded movieclips wont playback.

       

      When exporting a Quicktime movie, some frames are skipped and missing in the output! So the export options in Flash are totally not working for my situation. We bought an application SWF to image but also here are some frames missing in the export. I can not relay on Flash and this application.

       

      The project is built like this: we made several movieclips and scaled them and put them in position. Then we made one new movieclip with all the earlier made movieclips inside. Then scaled the entire movieclip to the Cinemascope stage size.

       

      Are we using Flash in a wrong way here?

      Why does the exports functions don't work on my project? (built in movieclips won't play, quicktime mov skips images)

      How can i solve this problem?

       

      Thanks in advance,

       

      Greetings Henk

        • 1. Re: export problems multiple movieclips to image sequence
          moccamaximum Level 5

          It depends on the type of the animation you want to export in single frames. Is the animation heavily depending on realtime Actionscript then you need a very powerful computer to export this animation uncompressed without skipping files to a video/image sequence. Great tutorial about this can be found here .

          Is the animation framebased, so you can actually make a screenshot every move of the playhead inside the movieclip, then you would have to write a short jsfl-file which parses your library and automatically exports every movieclip frame by frame.

          For the Documentation of the Javascript-api go here

          • 2. Re: export problems multiple movieclips to image sequence
            Henk @ Villa Level 1

            Thank you for your answer .

             

            Our animations are made without actionscripting. Their vectorbased objects animated over time. The platform that we work on is Mac OSX and i have a very nice G5 Quad Core, 8 GB DDR3. So it is not a speed problem.

             

            My knowledge about actionscripting and other kinds of scripting is very little. This would not be neccesary if i could export from Flash itself. I hope that Adobe steps up and could fix this in an update instead of me searching for working around the export problem... Whats the use of building functions in a program if it does not work 100%? Exporting image sequence and export a good Quicktime does not work 100%. The .fla and the .swf are the only two sources i can rely on. I also tried to import the swf in Adobe Premiere and Adobe After Effects but this is also not working. It should be possible in After Effects when reading the software specifications. It only results in errors while trying to import the swf.

            • 3. Re: export problems multiple movieclips to image sequence
              moccamaximum Level 5

              Ok this is workaround but should in principle do what you want:

               

              //create an instance of library object
              var mylibrary = fl.getDocumentDOM().library;
              var doc = fl.getDocumentDOM();
              var tl = fl.getDocumentDOM().getTimeline();

               

              //get items in library in an Array
              itemArray = mylibrary.items;
              totalCount = itemArray.length;

               

              for(var i=0;i<totalCount;i++){
                  myItem = itemArray[i];
                  myItemType = myItem.itemType;
                  myItemName = myItem.name;
                  mylibrary.editItem(myItemName);
                  fcNum = tl.layers[0].frameCount;
                  for (f=0; f<fcNum;f++){
                          tl.setSelectedFrames(f, f)
                          framenum = f + 1;
                          //select your destination, on MAC use something like file:///Macintosh HD/Users/username/Desktop/
                          doc.exportPNG("file:///C|/test/"+myItemName+ "_" + framenum +".png", true, true);
                      }
              }

               

              1: open the fla file you want to convert to a movie and create a backup

              2: Create a new Flash Javascript file and insert the code above, Make sure you have enough hard disk space in your destination folder

              3: Press the play button and Flash will automatically parse through all items frame by frame in your library and save the images as png

              4: Take a break as it might take a long time

              • 4. Re: export problems multiple movieclips to image sequence
                Henk @ Villa Level 1

                Okay cool! thnx

                 

                I get an error when starting the playback button:

                 

                exportPNG: Argument number 1 is invalid

                • 5. Re: export problems multiple movieclips to image sequence
                  moccamaximum Level 5

                  Must be your filepath, the folder to which you export must already exist. Since you`re working on a MAC, use

                   

                  something like (adapt to your own filestructure)

                   

                  doc.exportPNG("file:///Macintosh HD/myFolder/"+myItemName+ "_" + framenum +".png", true, true);

                  • 6. Re: export problems multiple movieclips to image sequence
                    Henk @ Villa Level 1

                    Yes i understand, i copied and paste the script but same error keeps coming up...

                     

                    Then I added 2 variables for the folder and filename changed the export script and i seemed to export something but it kept on going and had to force quit.

                     

                    //create an instance of library object
                    var mylibrary = fl.getDocumentDOM().library;
                    var doc = fl.getDocumentDOM();
                    var tl = fl.getDocumentDOM().getTimeline();

                    //library variables
                    var filename = new Array();

                    //folder variables
                    var folder;


                    //get items in library in an Array
                    itemArray = mylibrary.items;
                    totalCount = itemArray.length;



                    for(var i=0;i<totalCount;i++){
                        myItem = itemArray[i];
                        myItemType = myItem.itemType;
                        myItemName = myItem.name;
                        mylibrary.editItem(myItemName);
                        fcNum = tl.layers[0].frameCount;
                        for (f=0; f<fcNum;f++){
                                tl.setSelectedFrames(f, f)
                                framenum = f + 1;
                                //select your destination, on MAC use something like file:///Macintosh HD/Users/username/Desktop/
                                doc.exportPNG(folder+filename[i],true,true);

                            }
                    }

                    • 7. Re: export problems multiple movieclips to image sequence
                      moccamaximum Level 5

                      There might be a problem with items in the library that only consist of one frame (the loop will never start)
                      Try the attached file for testing to check whether it`s a file path related error.

                      • 8. Re: export problems multiple movieclips to image sequence
                        moccamaximum Level 5

                        There might be a problem with items in the library that only consist of one frame (the loop will never start)
                        Try the attached file for testing to check whether it`s a file path related error.

                        • 9. Re: export problems multiple movieclips to image sequence
                          Henk @ Villa Level 1

                          Strange the same error keeps occurring: exportPNG: Argument number 1 is invalid.

                           

                          Is the script working on your system with your attached FLA?

                           

                          //create an instance of library object
                          var mylibrary = fl.getDocumentDOM().library;
                          var doc = fl.getDocumentDOM();
                          var tl = fl.getDocumentDOM().getTimeline();

                           

                           

                           

                          //get items in library in an Array
                          itemArray = mylibrary.items;
                          totalCount = itemArray.length;

                           

                           

                           

                          for(var i=0;i<totalCount;i++){
                              myItem = itemArray[i];
                              myItemType = myItem.itemType;
                              myItemName = myItem.name;
                              mylibrary.editItem(myItemName);
                              fcNum = tl.layers[0].frameCount;
                              for (f=0; f<fcNum;f++){
                                      tl.setSelectedFrames(f, f)
                                      framenum = f + 1;
                                      //select your destination, on MAC use something like file:///Macintosh HD/Users/username/Desktop/
                                      doc.exportPNG("file:///Macintosh HD/Gebruikers/user/Bureaublad/"+myItemName+ "_" + framenum +".png", true, true);
                                  }
                          }

                          • 10. Re: export problems multiple movieclips to image sequence
                            moccamaximum Level 5

                            Okay, found the problem, Flash IDE seems to loose the focus while switching between the jsfl/fla file.

                             

                            Insert one more line of code, to be sure, the layer is properly selected:

                             

                            //create an instance of library object
                            var mylibrary = fl.getDocumentDOM().library;
                            var doc = fl.getDocumentDOM();
                            var tl = fl.getDocumentDOM().getTimeline();

                             

                            //get items in library in an Array
                            itemArray = mylibrary.items;
                            totalCount = itemArray.length;

                             

                            for(var i=0;i<totalCount;i++){
                                myItem = itemArray[i];
                                myItemType = myItem.itemType;
                                myItemName = myItem.name;
                                mylibrary.editItem(myItemName);
                                fcNum = tl.layers[0].frameCount;
                                for (f=0; f<fcNum;f++){
                                        tl.setSelectedLayers(0);//added
                                        tl.setSelectedFrames(f,f,true);
                                        framenum = f + 1;
                                        //select your destination, on MAC use something like file:///Macintosh HD/Users/username/Desktop/
                                        doc.exportPNG("file:///C|/test/"+myItemName+ "_" + framenum +".png", true, true);
                                    }
                            }

                            • 11. Re: export problems multiple movieclips to image sequence
                              Henk @ Villa Level 1

                              I'm sorry but the error stills occurs...