1 Reply Latest reply on Feb 16, 2011 9:38 PM by Erkki Pennanen

    How to get poster image (from_movie) when placing SWF file with JS?

    Erkki Pennanen

      I am able to place the poster from movie (flv) file. SWF files seems to belong to Movie class. I can place the generic posters (standard, none and proxy_image), but not "FROM_MOVIE".

       

      I am getting the following error message:

      "Error 81926" "The poster image could not be changed to the requested image".

       

      I will attach my code (sligtly modified from the sample "placeMOVIE" which is coming with CS5) containing also code for other property settings to be tested.

       

      Hoping to find a good solution for this, thanks in advance!

       

      Erkki

       

      -----------------------------

       

      /PlaceMovie.jsx
      //An InDesign CS5 JavaScript
      //
      //Shows how to import a movie  file.
      main();
      function main(){
          mySetup();
          mySnippet();
          myTeardown();
      }
      function mySetup(){
          var myDocument = app.documents.add();
          myDocument.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.points;
          myDocument.viewPreferences.verticalMeasurementUnits = MeasurementUnits.points;
          myDocument.viewPreferences.rulerOrigin = RulerOrigin.pageOrigin;
      }
      function mySnippet(){
          var myDocument = app.documents.item(0);
          var myPage = myDocument.pages.item(0);
          //<fragment>
          //Given a page "myPage"...
          var myFrame1 = myPage.rectangles.add({geometricBounds:[72, 72, 288, 288]});
          //Import a movie file (you'll have to provide a valid file path on your system);
          var myMovie = myFrame1.place(File("~/Desktop/SWFsivut/a1.flv"))[0];
         
          //alert("myMovie.name: " + myMovie.name)
          //alert("myMovie.visibleBounds: " + myMovie.visibleBounds)
          var mySWF_bounds = myMovie.visibleBounds;
          myFrame1.remove();
          var myFrame2 = myPage.rectangles.add({geometricBounds:mySWF_bounds});
          var myMovie2 = myFrame2.place(File("~/Desktop/SWFsivut/01.swf"))[0];
          //alert("myMovie2.name: " + myMovie.name)
          //alert("myMovie2.constructor: " + myMovie.constructor.name)
          //alert("myMovie2.moviePosterType (DEFAULT), 1852796517 = NONE" + myMovie.moviePosterType);
          //myMovie2.moviePosterType = 1852796517; //NONE
          //alert("myMovie2.moviePosterType, 1852796517 = NONE: " + myMovie.moviePosterType);
          //myMovie2.moviePosterType = 2020623970; //STANDARD
          //alert("myMovie2.moviePosterType, 2020623970 = STANDARD: " + myMovie.moviePosterType);
          myMovie2.moviePosterType = 1298558310; //FROM_MOVIE
          //alert("myMovie2.moviePosterType, 1298558310 = FROM_MOVIE: " + myMovie.moviePosterType);
          //myMovie2.moviePosterType = 1299216505; //PROXY_IMAGE
          //Add a preview image. You'll have to provide a valid path on your system.
          //myMovie2.posterFile = "~/Desktop/SWFsivut/a1.flv"; // this path works with colons !!!!
          //myMovie2.posterFile = "EkinHD/SWFsivut/01b.jpg"; // this path dont with slahes !!!!
          //alert("myMovie2.moviePosterType, 1299216505 = PROXY_IMAGE !!!: " + myMovie.moviePosterType);
          //</fragment>
      }
      function myTeardown(){
      }