External Music Files

I currently use:


mySound = new Sound();
mySound.loadSound("music.mp3",true);

1.) How do I set the number of loops?
2.) What is the Actionscript code to unload the sound?

1) mySound.start(secondOffset,loop);

secondOffset An optional parameter that lets you start playing the sound at a specific point. For example, if you have a 30-second sound and want the sound to start playing in the middle, specify 15 for the secondOffset parameter. The sound is not delayed 15 seconds, but rather starts playing at the 15-second mark.

loop An optional parameter allowing you to specify the number of times the sound should play consecutively.

2) you can unload the sound with

delete mySound;

I did this (below) and the music didn’t loop.


mySound = new Sound();
mySound.loadSound("music.mp3",true);
mySound.start(0,99);

Hey neo, I had the same problem as well in a previous project I made. For some reason the mp3 did not loop until it ended once. So for example, my 15 seconds mp3 started 15 seconds after mySound was loaded. I put a temporary fix on it by using a setInterval command. I never did find a real fix for it.

I cannot follow you. Sorry; I am only a beginning Actionscripter. So what is the whole script for infinitely looping an external MP3?

well i used your exact same code and had the exact same problem. What I did to fix it is not that good. I think you should find some kind of official fix for this problem.