开发者

Actionscript3 play multiple sounds

开发者 https://www.devze.com 2023-02-13 13:44 出处:网络
I am writing a simple Flash space-shooter-type game. Every time the player fires or an enemy is shot I play a sound. The problem is sound appear to be \"blocking\" - if the player shoots very often (i

I am writing a simple Flash space-shooter-type game. Every time the player fires or an enemy is shot I play a sound. The problem is sound appear to be "blocking" - if the player shoots very often (i.e. before previous sound has finished) the new sound will not play until the previous one has finished. Here is my code:

//constructor- pre-load all sounds 
fireSound = new Sound();
var req:URLRequest = new URLRequest("fire.mp3");
fireSound.load(req);    

//enter frame listener- play sound
//if space b开发者_开发百科ar pressed
fireSound.play();
//if enemy shot
otherSound.play();
0

精彩评论

暂无评论...
验证码 换一张
取 消