Dynamically loaded mp3...I wish

Hey Everyone,

I’ve searched the forums and tutorials and I’m using the code below to load an mp3 dynamically into an empty movie clip.

I want the mp3 loop play once the movie has been loaded.

Tell me if I messed up the code below:


this.onEnterFrame = function () {
_root.createEmptyMovieClip(“container”, 1);
mySound = new Sound();
mySound.loadSound(“introloop.mp3”,false);
}


Note: when I had the streaming set to “true”, the mp3 sounded crappy. So I changed it to false and there was no sound at all.

Thanks for any suggestions.

I’m going to guess that you have a mySound.start() sitting on a movieClip or a different layer or else it won’t start. The reason that when you set streaming to ‘false’, Flash will load the entire sound before playing it. There should be no difference in quality when externally loading the mp3 unless there is a problem with your mp3. Check this out:


mySound=new Sound();
mySound.loadSound("introloop.mp3",true);
mySound.onSoundComplete = loopSound;
loopSound = function () {
mySound.loadSound("introloop.mp3", true);
mySound.start();
};

There is a pause inbetween each play, if you want around that, you need to load the mp3 into your library, and loop it internally.

The mp3 is fine.

I may have the code in the wrong place. For example, imagine, you opened a new Flash Document and the code is placed in the 2nd frame. That’s where I put it.

How many frames does your fla contain?