开发者

Actionscript3 play multiple sounds

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜