KEMBAR78
Setting XMLPath Using Flash Vars | PDF
0% found this document useful (0 votes)
63 views2 pages

Setting XMLPath Using Flash Vars

This will allow you to set IMG Thumbnail Gallery's content without modifying your flash file. The simplest way to pass variables from HTML to flash is to use FlashVars.

Uploaded by

ksodomsky76
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
63 views2 pages

Setting XMLPath Using Flash Vars

This will allow you to set IMG Thumbnail Gallery's content without modifying your flash file. The simplest way to pass variables from HTML to flash is to use FlashVars.

Uploaded by

ksodomsky76
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

AFComponents.

com
Setting XML Path Using FlashVars
Updated: May 14, 2007 Views: 5234
Description: In this tutorial we are going to show you how to set the path to a XML file
using FlashVars. This will allow you to set IMG Thumbnail Gallery's content without
modifying your flash file.
PART 1 - FLASH

We need to add a few lines of code to our Flash document that "tell" the IMG Thumbnail
Gallery Component which XML file to load.

1. Create a new Flash document, for best results set the document Frame Rate to 30 or
higher to avoid motion graphics appearing choppy.

2. Drag the IMG Thumbnail Gallery Component in the center of the stage from you
Component Library. Make sure the IMG Thumbnail Gallery Component is positioned
on a whole number i.e. 2.0 opposed to 2.3 to avoid blurry text and graphics.

3. Give the IMG Thumbnail Gallery Component an Instance name myThumbGallery.


4. Paste the code below on the first frame of your movie in a new layer preferably named
AS or ActionScript for easy reference in the future.
5. Save your file as img_thumb_tutorial.fla.

// CODE INSIDE FLASH START ---------------------

myThumbGallery.contentXML = xmlFile;

// CODE INSIDE FLASH END ---------------------

The code above loads xmlFile variable (we are going to define it later) and tells FLV List
Gallery Component which XML file to load.

Make sure your file is saved as version Flash 8 and ActionScript is set to 2.0 or higher for
publishing.

Now on to the HTML

PART 2 HTML

Now we need to pass xmlFile to the IMG Thumbnail Gallery Component so it knows
which XML file to load.

There are several ways to pass variables from HTML to Flash. The simplest way is to use
FlashVars and this is exactly what we are going to do below.
// CODE INSIDE HTML START ---------------------

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/sw
flash.cab#version=8,0,0,0" width="550" height="400">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="img_thumb_tutorial.swf" />
<param name="FlashVars"
value="xmlFile=http://www.afcomponents.com/components/img_thumbnail_galler
y/content.xml" />
<embed src="img_thumb_tutorial.swf"
FlashVars="xmlFile=http://www.afcomponents.com/components/img_thumbnail_
gallery/content.xml" width="550" height="400" align="middle"
allowScriptAccess="sameDomain" type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>

// CODE INSIDE HTML END ------------------------

The code above shows how to pass the xmlFile variable to a Flash movie using
FlashVars. As you can see we are passing file.xml inside <param name="FlashVars"
value="xmlFile=http://www.afcomponents.com/components/img_thumbnail_
gallery/content.xml" /> tag.

Thats all there is to it!

2005-2007 advanced flash components

You might also like