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

best way to handle sounds in AS3

Community Beginner ,
Jun 10, 2011 Jun 10, 2011

Copy link to clipboard

Copied

I'm currently doing some game development, targeting iOS and Android devices using Flash Pro and AS3.  I'm doing my best to keep the code highly optomized and doing as much object pooling as possible. So far, I'm very pleased with how smooth everything is running on the devices.

I have noticed that when the actual 'game play' starts up, there is often a short hitch the when any particular sound effect is called up for the first time.  After the first time its seems fine.

I can only assume that the hitch in game play is Air loading up the soud file into memory (which is why it's hitching only on the first call). 

I'm a bit of a novice when it comes to audio, but I'm wondering if there is a best practices when it comes to managing the various sound fx and sound tracks so everything plays smoothly 'without a hitch'.  har har.  Currently the sounds reside in my Library as exentions of the Sound class, and i just crate an instance of those classes at run time and .play() when i want to call them.

Thanks ahead of time,

-dis

TOPICS
Development

Views

1.0K

Translate

Translate

Report

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
LEGEND ,
Jun 10, 2011 Jun 10, 2011

Copy link to clipboard

Copied

I have noticed that the first play of a sound in iOS can be delayed, but subsequent plays are ok. So, just play the sound ahead of time, at zero volume. Then it'll be ready for when it's really needed.

Votes

Translate

Translate

Report

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 Beginner ,
Jun 10, 2011 Jun 10, 2011

Copy link to clipboard

Copied

Yeah, I have thought about that, it just seemed like an awfully sloppy solution. I was kinda hoping for a non 'hack' method to get them properly loaded into memory- but if thats they only current way- then thats the only currenty way.

-dis

Votes

Translate

Translate

Report

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
Mentor ,
Jun 13, 2011 Jun 13, 2011

Copy link to clipboard

Copied

LATEST

Else start your mp3 with some interval.

Votes

Translate

Translate

Report

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