This example shows how to use FlashVars in the embed scripts to dynamically pass the path for the XML into the Slideshow from the html webpage. By default, all of our example FLA and SWF files have been set up to support FlashVars, but if you are working with a modified FLA or the default Slideshow component from the MXP file, you will need to follow these steps to enable the FlashVars support. This example utilizes a stand-alone slideshow component (300x300 pixels).
- Using your Flash 8/CS3/CS4 authoring software, open an existing FLA that includes the Slideshow component, or install the MXP and add the Slideshow component to the stage.
- Select the Slideshow on the stage and give it an instance name of "mySlideshow" then open the Component Inspector (in the "Window" menu) and delete the hardcoded path for the XML in the "xmlLocation" parameter field.
- Open the actions panel (scene 1: frame 1) and add the following line of action script:
- Publish or export a network ready SWF.
- To add the Slideshow SWF to your webpage you must add the following scripts to your web document wherever you want the Slideshow to appear. Please note that the SWF path, Flash player size (width and height; should be equal to SWF dimensions), and XML path (FlashVars; red text) are specified in two places. You can alter these variables to meet your needs, and you can specify a different XML path for each instance of the Slideshow on your site (e.g. you could use "playlist=images1.xml" for a header slideshow and "playlist=images2.xml" for a sidebar slideshow on the same page).
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"
width="300" height="300" >
<param name="movie" value="slideshow_dynamic.swf" />
<param name="FlashVars" value="playlist=images.xml" />
<embed src="slideshow_dynamic.swf" width="300" height="300" FlashVars="playlist=images.xml"
type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />