...

need flash mx actionscript help, addressing variable from nested movie

ecoli
11-19-2004, 12:43 AM
ok... so i think this is fairly straight forward, however i am still new to actionscripting and am just figuring out much of the syntax.

so i have built an mp3 player with an external file loader. everything works great except now i am trying to add a script at the end of each song file swf that loads the next song in the sequence in it's place (thereby unloading itself), but also increasing a variable called "songnum" which is declared in a movie clip called 'buttons' in the root movie that holds the back/forward track buttons, which keeps track of which file is currently playing so the forward and back buttons will still go to the correct track.

so here's what i've got:

controller.swf (main shell) contains an empty movie space called 'soundspace' which initially loads song1.swf. that file has the streaming mp3 and a scrolling title. frame 1 of the buttons clip declares "songnum" with an initial value of 1. forward and back buttons are properly set up so forward loads the next file, song"+songnum+".swf. that part works.

now i've changed the initial declaration of songnum to be _global.songnum = 1 so that i can address it from the nested movie.

so in the last frame of the song1.swf, after the song ends, there is:
songnum = 2;
_root.soundspace.loadMovie("swf/song2.swf");

which, so far works to load song2.swf in place of song1.swf. but while it's playing, if i hit the forward button, it loads song2.swf again. i want songnum to be set at 2 automatically, so the forward button will load song3.swf while song2.swf is playing. since it's loading song2.swf again, obviously the new value for songnum is not getting passed on properly.

what am i missing?

hope this is enough info.

thanks in advance!

skye

ecoli
11-19-2004, 04:22 AM
nevermind, i finally fixed it... after trying a billion things.

the end of each song needs to have:

_root._global.songnum = x;

where x is the number i want to assign to songnum.

christ... i tried every possible thing, but never tried _root 'cause i assumed once you make something _global you can address it from anywhere with just _global.varname

oh well... what a relief! hours and hours of ARGHGHGHG. :)

skye



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum