-
1. Re: relinking?
Laubender Apr 20, 2012 11:45 PM (in response to Petteri_Paananen)@Petteri – it seems that the standard poster image is placed immediately after placing the swf file.
So to reach it you could do it by index or by name.I make an assumption here: to reach it by name could be a little bit uncertain, if the user did tricks with the original image sitting in a subfolder of the InDesign installation (but I did not test, if it's possible not only to alter its contents but also it's file path and name).
So let's play save and assume it's the last link that came to the links collection immediately after placing the SWF:
var mySWFPosterImageLink = app.documents[0].links[-1];
Links can be relinked, so:
var myNewSWFPosterImageFile = File("fullImageFilePathHere"); mySWFPosterImageLink.relink(myNewSWFPosterImageFile);should do the job.
If you seek for a relationship between the placed SWF ([object Movie]) and the standard poster image, look for:
var myPlacedSWFLink = app.documents[0].links[-2];
immediately after placing the SWF.
Uwe
-
2. Re: relinking?
Laubender Apr 21, 2012 12:25 AM (in response to Laubender)@Petteri – Oh, I forgot, the second part of the question was how we could fit the poster image to its frame.
To get that we have to do look at the geometricBounds of the frame that holds the swf and apply that to the image inside the frame, which actually sits inside the placed SWF object:var myPlacedSWFContainer = myPlacedSWFLink.parent.parent; myPlacedSWFContainer.pageItems[0].graphics[0].geometricBounds = myPlacedSWFContainer.geometricBounds;
My testing showed that would do the job.
Have a nice weekend!
Uwe
-
3. Re: relinking?
Laubender Apr 21, 2012 12:49 AM (in response to Laubender)@Petteri – instead of:
myPlacedSWFContainer.pageItems[0].graphics[0].geometricBounds =
you could also write:
myPlacedSWFContainer.movies[0].graphics[0].geometricBounds =
Since we know that a placed SWF is of object type [object Movie].
Uwe
-
4. Re: relinking?
Petteri_Paananen Apr 21, 2012 1:41 AM (in response to Laubender)Hey that´s amazing... it works!!! Million thanks to you...
Could you say how i can make it run inside the loop. All the new link names are named as running numbers starting from 1.jpg, 2.jpg and so on...
The line you suggested
var myNewSWFPosterImageFile = File("/Users/user/Desktop/dumpster/poster 2/1.jpg");
produces naturally same poster image 1.jpg to every SWF-instance.
I tried to change it to
for (myCounter = 0; myCounter < myNumberOfFrames; myCounter++){
var mySWFPosterImageLink = app.documents[0].links[-1];
var myNewSWFPosterImageFile = File("/Users/petteripaananen/Desktop/dumpster/poster 2/" + myCounter + ".jpg");
But it didn´t work, I got the following warning:
-
5. Re: relinking?
Petteri_Paananen Apr 21, 2012 1:46 AM (in response to Petteri_Paananen)..forget the last one... I just realized that loop starts from 0.jpg instead of 1.jpg and since there´s not file named 0.jpg, it gives me that erros. If I start images from 0.jpg, everything works perfectly... thanks again...=)


