PDA

View Full Version : Passing a variable to a loaded movie


edacsac
10-12-2005, 12:07 AM
I'm trying to think of a way to make a site I'm working on more dynamic. Right now I'm in a position where a movie clip loads a movie that creates a list of buttons inside a scrollpane via an XML file. The XML file contains .swf name and caption for the button. Clicking one of those buttons a sends the command to load that particular movie into the movie clip, which happens to be a picture gallery that also gets its images and captions from different XML file. I need to bridge the gap. When the button is clicked, I would like to load a single generic "image gallery" .swf, and send said .swf the name of the xml file to load. Right now, the clicked button loads a seperate .swf for each gallery, and the only difference per .swf is the XML file it loads - which is hard coded into the AS.

Is it possible to use some type of loadMovie function and send that loaded movie a variable to determine which XML file to load? Sounds like something that is really possible, but I haven't seen anything related to that.

Thanks for any responses!

Cota
10-12-2005, 12:31 AM
try thinking about it in reverse. Making a variable available to the loaded movie. There are a few ways of doing this. To me, the easiest way is setting a _global variable. In your loaded movie you just refence the variable _global.variableName.

edacsac
10-12-2005, 02:58 PM
Thanks Cota,

Thats a great idea, and I appreciate you sharing it with me! Now I just have to figure out how to get it in there. It's alot easier to do things up front, then try to fit them in later when you haven't made preperations for them.

Cota
10-12-2005, 07:02 PM
Thats the power of psuedo code. Write things out before you start coding. Get a better idea of what you'll need. Functions, variables, maybe even discover a few problems before you actually run into them.