5 Replies Latest reply on Oct 4, 2013 9:01 PM by Ramjivk

    Need help in Exporting SWF file from InDesign using script

    Ramjivk

      Hi,

       

      I am using InDesign CS5.5. I have document which has Object states and animation. I need an output file as PDF. When i export the PDF as Interactive PDF, the object state does not work.

       

      So i decided to export the file as SWF and create a blank page at the end of the same document and import the SWF back to InDesign and again export it as Interactive PDF. so that SWF can be played in Acrobat.

       

      But the probelm i am facing is SWF will not play when i open the PDF. i have to clcik the SWF in the PDF to play it. to overcome this issue, InDesign has a Pannel call "Media:. so i select the SWF link in InDesign and go to Media pannel and select the option "play on page load". then export it as interactive PDF. it works.

       

      Is someone help me a scripting the last part of my work flow, selecting the SWF file in InDesign and applying the "play on page load"option in Media pannel.

       

      let me know if you are not clear of any part.

       

      thanks.

        • 1. Re: Need help in Exporting SWF file from InDesign using script
          marius_9 Level 1

          Hi,

           

          I have exactly the same problem. Did you find a solution ?

           

          Thanks

          • 2. Re: Need help in Exporting SWF file from InDesign using script
            Ramjivk Level 1

            Hi,

             

            where are you struck? can you send the script line?

            1 person found this helpful
            • 3. Re: Need help in Exporting SWF file from InDesign using script
              marius_9 Level 1

              The script is quite simple, but I don't really know where to set the event ON_PAGE_LOAD to have a working swf file.

               

              // Open file

              var myDocument = app.activeDocument;

              // Export SWF

              app.swfExportPreferences.generateHTML=true;

              app.swfExportPreferences.includeInteractivePageCurl=false;

              app.swfExportPreferences.viewSWFAfterExporting=false;

              // Try to add trigger on parent page 

              var myPage = myDocument.pages.firstItem();

              var myTimingSettings = myPage.parent.timingSettings;

              myTimingSettings.timingLists.add(DynamicTriggerEvents.ON_PAGE_LOAD);

              // Export file

              myDocument.exportFile(ExportFormat.SWF, "/path/to/file/sortie.swf");

               

              On my page I have a simple textFrame with a custom path.

              Thanks

              1 person found this helpful
              • 4. Re: Need help in Exporting SWF file from InDesign using script
                marius_9 Level 1

                I found the answer. For those who are interested, you have to add a timingList and a timingGroup on the parent of the current page :

                 

                // Open file

                var myDocument = app.activeDocument;

                var myPage = myDocument.pages.firstItem();

                var myItem = myPage.pageItems.firstItem();

                // Export SWF

                app.swfExportPreferences.generateHTML=true;

                app.swfExportPreferences.includeInteractivePageCurl=false;

                app.swfExportPreferences.viewSWFAfterExporting=false;

                // Add timing list

                var theTimingList = myPage.parent.timingSettings.timingLists.add(DynamicTriggerEvents.ON_PAGE_LOAD);

                // Add timing group

                var theTimingGroup = theTimingList.timingGroups.add(myItem);

                // Export file

                myDocument.exportFile(ExportFormat.SWF, "/path/to/file/document.swf");

                1 person found this helpful
                • 5. Re: Need help in Exporting SWF file from InDesign using script
                  Ramjivk Level 1

                  Hi,

                   

                  My issues is in exporting the SWF to PDF, not in the HTML. I used the below code to fix that issue. so while placing the SWF file i set the property of play on page load to true. so the PDF starts playing the SWF file after exporting it as interactive PDF.

                   

                       var myDocument = app.activeDocument.pages.add();

                      

                       myPageHeight = app.activeDocument.documentPreferences.pageHeight;

                       myPageWidth = app.activeDocument.documentPreferences.pageWidth;

                       myRectangle = myDocument.rectangles.add({geometricBounds:[0, 0, myPageHeight, myPageWidth]});

                      

                       var myMovie = myRectangle.place(File("/path/test.swf"));

                   

                      myMovie.embedInPDF = true;

                      myMovie.playOnPageTurn = true;

                   

                       app.activeDocument.exportFile(ExportFormat.interactivePDF, File("/path/test.pdf"),false);

                   

                  after that i export the PDF as interactive PDF.

                   

                  hope it helps.