views:

69

answers:

1

I'm trying to play some sounds in my flash project through action script. However for some reason in my code the call to Sound.play takes from 40ms to over 100ms in extreme cases, which is obviously more than enough to be very noticeable whenever a sound is played. This happens every time a sound is played, not just when that sound is first played, so I dont think its because the Sound object is still loading data or anything like that...

At the start I have this to load the sound:

class MyClass
{
    [Embed(source='data/test_snd.mp3')] private var TestSound:Class;
    private var testSound:Sound;//flash.media.Sound
    public function MyClass()
    {
       testSound = new TestSound();
    }

Then im just using the play method of the sound object to play it later on.

testSound.play();//seems to take a long time to return

This as far as I can tell is following the same process as other Flash programs I found, however none of them seem to have this problem. Is there something that I've missed that would cause the play() method to be so slow?