Music player tutorials

i have a loop that i want to load dynamically so it doesn’t make my site’s load time huge and i want it to play. i only want a stop and a play button and a volume slider which I know how to make … but i can’t get the music to load and play the way i want

sometimes the music starts … sometimes it doesn’t. i just sorta figured out how to do it on my own but i’m sure there’s a tried and true way since many of you have music that loads from external files on your sites cough electrongeek cough

anyway … any help is greatly appreciated

thanks

Use the Sound() object found in Flash MX…

Look up all the facts about the Sound() object and you should find a whole bunch of things to use… But remember… When loading music in dynamically… To test to see if it’s fully loaded first or not…

mymusic = new Sound();
mymusic.loadSound(“http://www.somesite.com/music.mp3”, FALSE);

That will make a new sound object and load it up. Then you’ll just need a looping subtype.

[AS]
if(mymusic.duration = mymusic.position)
{
mymusic.start(0, 1);
}
[/AS]

That way… It’ll keep looping :wink:

Hope this helps you out some.

playamarz :player:

ok thanks i’ll try to get this working :slight_smile:

but shouldn’t the code read

if(mymusic.duration == mymusic.position)
{
mymusic.start(0, 1);
}

since == checks for equality

??

here is the best ever sound tutorial for Flash MX:

http://www.flashkit.com/tutorials/Audio/Flash_MX-Kenny_Be-824/

Yeah… Sorry about that… Forgot to place in the extra = sign. I do that sometimes when I’m typing too fast :stuck_out_tongue:

playamarz

alright so i have the sound loaded and playing … btw thx jubba that’s a great tutorial.

but i can’t figure out how to load it dynamically and loop it simultaneously … that doesn’t seem to be in the tutorial

here’s the script i have currently:


myMusic = new Sound(myMusicMc);
myMusic.loadSound("sounds/7.mp3", true);