I’ve created a preloader for external sounds. It runs fine when I test movie. I tried testing with “Simulate Download”.
Here’s the problem, the snd_loader_text is the instance name of a dynamic text field. But the progress does not appear there. It’s only blank when I simulate download or even put my work online. But the trace(snd_loader_txt.text); shows the changing values perfectly. Why are they not showing? No. 2. It seems to work fine when I simulate download but it keeps loading forever when I place it online. Please help.
stop();
var soundClip:Sound = new Sound();
var soundChannel:SoundChannel = new SoundChannel();
var soundPlaying:int = 0;
soundClip.load(new URLRequest(“TheMorning.mp3”));
soundClip.addEventListener(ProgressEvent.PROGRESS, soundLoading);
function soundLoading(e: ProgressEvent):void
{
snd_loader_txt.text = int(e.bytesLoaded/e.bytesTotal*100) + “%”;
trace(snd_loader_txt.text);
if (e.bytesTotal == e.bytesLoaded)
{
play();
this.removeEventListener(Event.ENTER_FRAME, loading);
}
}