Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

updating vars when using loadMovieNum();

Status
Not open for further replies.

silverswim

Programmer
Oct 17, 2001
50
GB
Hi,
I need to have a global variable which can be accessed by swf's that are loaded into various levels using loadMovieNum()
I have used _global.myVar etc.
If I load other movies into the Level 0, and then others on top, how could the player store the value of the global variable?

Also, how can I get the variable set at the first page on level 0 , but then take on updated values of the variable if the user revisits the first page?

Thanks so much in advance, Silverswim
 
If you use & set a _global.my_var in one main movie, and then replace the main movie on level 0 with another one, the _global.my_var variable should still be available in the new main movie or in other movies loaded on other levels of that new main movie, but only when you're sure the movies are fully loaded, and usually not accessing it on the same actionscript as the loadMovieNum action itself.
 
Thanks very much oldnewbie;
I'm going to load up on the first frame and use the function macromedia give which tests for success before moving into the start of the actual movie...
Silverswim
 
Hi again...still having problems:

I have to store the variable in a text file and then get it with LoadVars . I used the onLoad function and when success is true, the code tells the movie to gotoAndPlay a labelled frame on a new level. At that frame, the variable is passed into a switch statement, but falls right through and the default keeps being used.
A trace finds the variable listed correctly, but as the switch couldn't use it, Flash is loading it as a string character, isnt that right? So I used
myVar = Number(myVar);
but now the trace lists it as NaN.

Can the light be shined on this please?
Silverswim




 
Can you post your code or a link to that .fla, zipped up and in MX only format?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top