# Music player tutorials

**URL:** https://forum.kirupa.com/t/music-player-tutorials/16833
**Category:** Uncategorized
**Created:** [March 28, 2003, 8:33pm UTC](https://forum.kirupa.com/t/music-player-tutorials/16833 "2003-03-28T20:33:32Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![shuga](https://avatars.discourse-cdn.com/v4/letter/s/a9adbd/32.png) [@shuga](https://forum.kirupa.com/u/shuga)
#### Post date: [March 28, 2003, 8:33pm UTC](https://forum.kirupa.com/t/music-player-tutorials/16833/1 "2003-03-28T20:33:32Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [March 28, 2003, 9:15pm UTC](https://forum.kirupa.com/t/music-player-tutorials/16833/2 "2003-03-28T21:15:01Z")

</div>

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](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 😉

Hope this helps you out some.

playamarz :player:

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [March 28, 2003, 9:33pm UTC](https://forum.kirupa.com/t/music-player-tutorials/16833/3 "2003-03-28T21:33:18Z")

</div>

ok thanks i’ll try to get this working 🙂

but shouldn’t the code read

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

since == checks for equality

??

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [March 28, 2003, 9:46pm UTC](https://forum.kirupa.com/t/music-player-tutorials/16833/4 "2003-03-28T21:46:53Z")

</div>

here is the best ever sound tutorial for Flash MX:

[http://www.flashkit.com/tutorials/Audio/Flash\_MX-Kenny\_Be-824/](http://www.flashkit.com/tutorials/Audio/Flash_MX-Kenny_Be-824/)

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [March 29, 2003, 5:45am UTC](https://forum.kirupa.com/t/music-player-tutorials/16833/5 "2003-03-29T05:45:39Z")

</div>

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

playamarz

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [April 1, 2003, 5:14am UTC](https://forum.kirupa.com/t/music-player-tutorials/16833/6 "2003-04-01T05:14:55Z")

</div>

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:

```php

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

```
