Hey, gang.
So I’ve got what I’m hoping is a common problem with an easy fix.
I’m working on a game in Flash, and everything’s going along great, until I start trying to play sound effects. The minute I start trying to play a sound, the whole app seems to “hiccup”, frames get dropped, and things generally get ugly for a little bit.
I’m loading sounds by copying them into my Flash CS3 library, exporting them for ActionScript with a Base Class of flash.media.Sound.
I’m playing them through a class that looks a little something like this…
public class SoundPlayer {
private var _mySound:Sound;
public function SoundPlayer()
{
_mySound = new ExampleGame.SoundFromLibrary();
}
public function playSound()
{
_mySound.play();
}
}
This all seems pretty straightforward, so I can’t figure out why Flash is complaining when it first tries to play the sound. The sound itself is a 40k. mp3 file that lasts about 2 seconds. Not the shortest sound in the world, but I’m sure I’ve heard larger sounds in games.
Are there any obvious tips or tricks I’m missing here?