Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Aug 2004
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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

  • #2
    New to the CF scene
    Join Date
    Aug 2004
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •