我正在尝试将动画同步到特定BPM的音乐.我尝试过使用Timer但是在处理小间隔时(毫秒)并不准确.我做了一些阅读,发现了另一种使用小型静音音频文件和SOUND_COMPLETE事件作为计时器的方法.
package { import flash.events.Event; import flash.events.EventDispatcher; import flash.media.Sound; import flash.media.SoundChannel; import flash.net.URLRequest; public class BetterTimer extends EventDispatcher { private var silentSound:Sound; public function BetterTimer(silentSoundUrl:String):void { super(); silentSound = new Sound( new URLRequest(silentSoundUrl) ); silentSound.addEventListener(Event.COMPLETE,start); } public function start():void { this.timerFired( new Event("start") ); } private function timerFired(e:Event):void { dispatchEvent( new Event("fire") ); var channel:SoundChannel = silentSound.play(); channel.addEventListener(Event.SOUND_COMPLETE,timerFired,false,true); } } }
这仍然没有留下来. Flash Player是否具有声音准确性?