Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to prevent Sound.load slow down FPS?

Explorer ,
Oct 29, 2015 Oct 29, 2015

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!

TOPICS
ActionScript
471
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 29, 2015 Oct 29, 2015

preload your sound or display a simple non-cpu taxing animation while the sound is loading.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 29, 2015 Oct 29, 2015

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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Oct 31, 2015 Oct 31, 2015
LATEST

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);

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines