flash.media.Sound.play takes long time to return
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 p开发者_如何转开发lay() method to be so slow?
This might help:
http://www.ghostwire.com/blog/archives/as3-fixing-the-lag-that-arises-when-playing-a-short-sound-effect/
Latency in playing short sounds in Flash 9, Actionscript 3
精彩评论