Copy link to clipboard
Copied
Hi!
I have a mp3 player app write by AS3 with main swf load embedded swf that load external sound and playback it with some animations. I've set my app FPS by 60. Everything work well in local (with flash debugger), but problem appear when I host my app on php server. In the first time sound load, FPS slow down (about 20) while sound loading or even sound fully loaded. So, it make animations is very slow. But, when run my app in the next times (refresh browser), it work well because (I think) sound are cached. I try to clear browser cache and run my app, the problem appear again.
How can I fix that? Thank for advance!
Copy link to clipboard
Copied
preload your sound or display a simple non-cpu taxing animation while the sound is loading.
Copy link to clipboard
Copied
kglad a écrit:
preload your sound or display a simple non-cpu taxing animation while the sound is loading.
Sorry, I don't quite understand. Can you clarify?
Copy link to clipboard
Copied
Add a complete event listener to your sound and play it on load complete, (preload your sound).
var my_sound:Sound = new Sound();
my_sound.addEventListener(Event.COMPLETE, onSoundLoaded);
my_sound.addEventListener(IOErrorEvent.IO_ERROR, onSoundLoadError);
my_sound.load(new URLRequest("sound.mp3"));
function onSoundLoaded(e:Event):void
{
my_sound.play();
}
function onSoundLoadError(e:IOErrorEvent):void
{
trace(e.text);
}
Find more inspiration, events, and resources on the new Adobe Community
Explore Now