Go Back   CodingForums.com > :: Client side development > Flash & ActionScript

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-19-2004, 12:43 AM   PM User | #1
ecoli
New to the CF scene

 
Join Date: Aug 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
ecoli is an unknown quantity at this point
need flash mx actionscript help, addressing variable from nested movie

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 is offline   Reply With Quote
Old 11-19-2004, 04:22 AM   PM User | #2
ecoli
New to the CF scene

 
Join Date: Aug 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
ecoli is an unknown quantity at this point
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
ecoli is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:32 AM.


Advertisement
Log in to turn off these ads.