1
我可以打一個蜂鳴聲是這樣的:如何在Actionscript中播放短音?
private var beep:Sound = new Sound();
private function beepInit():void {
var beepHandler:Function = new Function();
beepHandler = function(event:SampleDataEvent):void {
for (var i:uint = 0; i < 2048; i++) {
var wavePos:Number = 20 * Math.PI * i/2048;
event.data.writeFloat(Math.sin(wavePos));
event.data.writeFloat(Math.sin(wavePos));
}
}
beep.addEventListener(SampleDataEvent.SAMPLE_DATA, beepHandler);
}
在應用程序啓動我打電話beepInit();
要播放,請調用:beep.play();
這是連續的聲音。我怎樣才能做到這一點? 500毫秒。短嗶?