PDA

View Full Version : passing vars to generator file using loadMovie


phatbuddha
06-26-2001, 08:54 AM
i'm developing a website for a client and he would like me to incorporate flash to create a dynamic 3-level menu system. basically the site is going to show 12 buttons, "Major Categories"...when a user clicks one it shows a list of that parent's "Minor Categories"...when a user clicks a minor category it shows a list of that parent's "Product Categories", and when a product category is clicked it will take the user to a certain webpage.

I'm using Generator for the minorCat and majorCat scrolling lists. My idea is to use a main SWF file, call it "project.swf", and in it have 12 buttons and a movie clip. when one of the 12 buttons is pressed it should load "minorCats.SWT" into the first movie clip, and send it the variable "currentMajorCatNum" as defined by which button you're pressing. Basically it's going to look like this:

http://www.bestpcquotes.com/flashmenu/layout.gif

where the circles are the buttons and the other area is the movie clip. inside the movie clip is just going to be a scrolling list using generator that i already have tested as working.

i have it set up so that when i enter a data source manually in minorCats.SWT using the set environment button at the top of the timeline like this:
----------
#Name, Value
currentMajorCatNum, 972
----------
972 is the number for the "cpu" major category. the reason we need the currentMajorCatNum is because the data source of the scrolling list is a PHP script, http://www.bestpcquotes.com/flashmenu/minorcategories.php?parentid=972. the thing is, i want it to be dynamic, as in

http://www.bestpcquotes.com/flashmenu/minorcategories.php?parentid={currentMinorCatNum}

i set the data source of the scrolling list to that string, and it works when i manually code in the data source as described it works correctly. however, i'm trying to call it from another flash file, so i'm using the loadMovie command. here's what i have attached to the CPU button

on (release) {
fCurrentMinorCatNum = "972";
loadMovie ("minorCatList.swt?currentMinorCatNum=" + fCurrentMinorCatNum, "minorCatListHolder");
}

minorCatListHolder is an instance of movieClipHolder (a Movie Clip the dimension of the minorCat.SWT file). the call to load movie works alright and doesn't give me any errors, and i can tell it called the movie as my blank placeholder gave way to a designed minorCat page, but the scrolling list no longer works.

basically, the SWT isn't accepting the currentMinorCatNum variable from the loadMovie call. what's wrong with my code?!