flex - Accurate BPM event listener in AS3 -
I am trying to synchronize the animation to music on a specific BPM. I tried to use the timer but when working with small intervals in milliseconds it is not true I read something and is an alternative method that uses a small silent audio file and SOUND_COMPLETE event as a timer.
I have used 167ms long sound file with this code.
package {import flash.events.Event; Import flash.events.EventDispatcher; Import Flash. Media. Sound; Import Flash. Media. Sound channel; Import flash.net.URLRequest; Public Class Best Timer EventDispatcher {private var silent Sound: Sound; Public Function Best Timer (silent sand URL: string): zero {super (); MuteSound = new sound (new URLRequest (silentSoundUrl)); MuteSound AddEventListener (Event.Complete, Start); } Start Public Function (): Zero {this.timerFired (New Event ("Start")); } Private Function TimerFide (E: Event): Zero {Dispatches (New Event ("Fire")); Var Channel: SoundChannel = MuteSound.play (); Channel.addEventListener (Event.SOUND_COMPLETE, TimerFide, False, 0, Truth); }}}
Does it still not on green Does Flash Player have to be able to accurately with sound?
It is very difficult to recover! A small lib trying to do this I have not tried to code myself, but if it does this then it claims that what it really is for you.
Comments
Post a Comment