Dynamic XML Path for SlideShoPro Director with SWFObject 2.2
If you have multiple galleries or albums, it’s much more efficient to have a single Flash .swf source file that can pull your XML file. Searching through the SlideShowPro Wiki as well as the forums and finding the exact (and up-to-date) solution took quite a bit of time, so I decided to provide the information together in a quick article…primarily for my own future reference.
Assumptions
- You have the lates version of SlideShowPro Director (1.4.3 as of this writing).
- You’re using ActionSript 3.
- You’re able to publish albumns normall, already.
Step 1: Add SWFObject to the Page
Link to the JavaScript by adding the string below just before the </head> closing tag.
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>
Step 2: Add ActionScript to your FLA
On the main timeline of your Flash file, create an actions frame and add the following code. Make sure you click on the component on the stage and give it the name "my_ssp".
var paramObj:Object = LoaderInfo(this.root.loaderInfo).parameters;
for (var param in paramObj) {
if (param == "xmlfile") {
my_ssp.xmlFilePath = paramObj[param];
}
if (param == "xmlfiletype") {
my_ssp.xmlFileType = paramObj[param];
}
}
Step 3: Embed the SWF and Update the XML File Path
The places in the code you should change are highlighted below. The Google SWF Object site has details on the flashvars, params and attributes JavaScript Objects.
<div id="flashcontent">ALTERNATE-DISPLAY-IF-NO-FLASH</div>
<script type="text/javascript" charset="utf-8">
var flashvars = {
xmlfile: "LINK-TO-YOUR-XML-DOCUMENT",
xmlfiletype: "Director"
}
var params = {
base: ".",
allowfullscreen: "true",
wmode: "transparent"
}
var attributes = {
id: "flashcontent"
}
swfobject.embedSWF("LINK-TO-YOUR-SLIDESHOW-SWF", "flashcontent", 250, 250, "10.0.0", false, flashvars, params, attributes);
</script>
Resources
Side Note: The galleries on this site are based off of the Layered interface Thumbgrid demo.

Wee Little Grasshopper


0 Comments