This example shows how to use FlashVars in the embed scripts to dynamically pass the path for the XML into the Banner Rotator 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 Banner Rotator component from the MXP file, you will need to follow these steps to enable the FlashVars support. This example utilizes a vertical rotator component (120x600 pixels).
- Using your Flash 8/CS3/CS4 authoring software, open an existing FLA that includes the Banner Rotator component, or install the MXP and add the Banner Rotator component to the stage.
- Select the Banner Rotator on the stage and give it an instance name of "myRotator" 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 Banner Rotator SWF to your webpage you must add the following embed script to your web document wherever you want the rotator 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 Banner Rotator on your site (e.g. you could use "playlist=banners1.xml" for a header rotator and "playlist=banners2.xml" for a sidebar rotator 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="160" height="200" >
<param name="movie" value="rotator_dynamic.swf" />
<param name="FlashVars" value="playlist=banners.xml" />
<embed src="rotator_dynamic.swf" width="160" height="200" FlashVars="playlist=banners.xml"
type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />