onSoundComplete(); - not sure how to make it work

Alright. So I don’t have the cash right now to get Flash CS3, so I’m limited to using Actionscript 2 and that’s what I have here. What I’m trying to do is use the onSoundComplete(); function, or something similar but not getting any results.

I’m doing a basic sort of mp3 player, though it only rotates between 3 songs. I have a character walking on stage as a movie clip, he’s carrying a radio which is a nested movie clip within the first, and within the radio movie clip is where I have it set that you can manually advance from one song to the other by hitting a forward button, and there’s also a volume slider. The first default song playing is “letsDance”, The second song playing is “outtasite” and the third song playing is “please”. They all work perfectly, the forward button to advance works, and the volume slider works.

What doesn’t work is when one song finishes, I want the next song to start. For now, I only included code for going from song 1 to song 2, but that’s not working so I decided to stop there.

Unfortunately, with the three .mp3s included even at 20 seconds each, my compressed .zip file is 1.2mb, bigger than the allowed 146kb .zip on the kirupa forum. Therefore, I cannot post it on the forum, but have it hosted on a web server. Anyone willing to look at the file, you can find it at:

http://www.ghcreativemedia.com/testFiles/testFile.zip

What’s in this .fla file right now is just the radio button and the volume slider, nothing else. I didn’t want to include any unnecessary extras so even the three songs that are included are even shortened down to about 20 seconds each. Each of these songs are located externally from the .swf file and are called in through the “loadSound” command.

Anyone who could shine some light or advice on why this isn’t working or a better way to follow on what’s going on here. I’ve read other things online about onSoundComplete(); like being used with music in arrays which I guess I could do, but I want to be sure I have control of advancing one song to the next and also adjusting the volume. Other things I’ve read about onSoundComplete(); is that it just doesn’t work.

Someone please give me some hope. I’d really appreciate it.

Thanks in advance.

there is a tut on gotoandlearn.com, which works, I know that much

best looking there and compare code

lazy responce

[quote=randomagain;2351731]there is a tut on gotoandlearn.com, which works, I know that much

best looking there and compare code

lazy responce[/quote]
^ yeah, no kidding.

I looked at your file, and you have actions all over the place. You should try keeping all of your actions in one frame if possible. I think you could go about this putting the tracks in an array and then loading them up as needed.

In fact, here you go: http://www.mediafire.com/?byjstyykalc
Cheers! :beer:

[QUOTE=project107;2351989]^ yeah, no kidding.

I looked at your file, and you have actions all over the place. You should try keeping all of your actions in one frame if possible. I think you could go about this putting the tracks in an array and then loading them up as needed.

In fact, here you go: http://www.mediafire.com/?byjstyykalc
Cheers! :beer:[/QUOTE]

Holy Sh*t ! It works in my flash file !! Of course it does. You knew that.

Wow. You don’t know how grateful I am. I was fussing with that thing for over 2 weeks trying to find alternate ways to do it and despite my “intermediate” level of actionscript, I couldn’t figure it out. I think what you got in there is just a tad bit above me but I’m going to go through it and make some sense of it. The comment lines help, as well. Thank you VERY much.

One thing that didn’t initially work in my flash movie, (but worked in yours) was the forward button. Somehow it wasn’t targeting or registering where it was, so I took the code and nested it within the movie clip for that button. I know, especially since you had said to keep the code clean and on the first main frame, this isn’t the best way to do it, but I was just so f-ing happy that the thing was working. I can finally move on with my project.

Thank You. Thank You. Thank You.

[quote=herman428;2352168]Holy Sh*t ! It works in my flash file !! Of course it does. You knew that.

Wow. You don’t know how grateful I am. I was fussing with that thing for over 2 weeks trying to find alternate ways to do it and despite my “intermediate” level of actionscript, I couldn’t figure it out. I think what you got in there is just a tad bit above me but I’m going to go through it and make some sense of it. The comment lines help, as well. Thank you VERY much.

One thing that didn’t initially work in my flash movie, (but worked in yours) was the forward button. Somehow it wasn’t targeting or registering where it was, so I took the code and nested it within the movie clip for that button. I know, especially since you had said to keep the code clean and on the first main frame, this isn’t the best way to do it, but I was just so f-ing happy that the thing was working. I can finally move on with my project.

Thank You. Thank You. Thank You.[/quote]

Cheers, mate! :beer:

so, what was the answer?

it would be usefull to have it here…in case anyone searches. am i wrong?

Putting the tracks in an array and calling them via button or onSoundComplete();. I would suggest you look at the file if you need the full code. :thumb: