How to make the timer accurate? (Flash / ActionScript 3.0)

I use the following method to send sound X times / minute (X is defined through bpm, which is a NumericStepper object)

var mainTimer:Timer = new Timer(60 / (bpm.value * 1000),0);
mainTimer.addEventListener(TimerEvent.TIMER, fl_TimerHandler,false, 0, true); 
mainTimer.start();

function fl_TimerHandler(event:TimerEvent):void
     {
        metroTransform.volume = vol;
        flash.media.SoundMixer.soundTransform = metroTransform;
        metroChannel = metro.play();
        mainTimer.delay = 60 / bpm.value * 1000;
      }

According to this http://www.metronomeonline.com/ the sound does not sit well. Is there something I can do to fix this problem I'm stuck in?

The path to the output file that I get: http://conatur.net/metroBig.swf

+3
source share
2 answers

http://cookbooks.adobe.com/post_Accurate_timer-17332.html can help you.


(fps, memory, play movie clip end i.e.). -, , , .


, . , ​​ - + /2. , - : delay - exact/2 flash-.

+3

Hum

60000 / bpm.value
// with BPM = 80 we have 60000/80 = 750

60 / (bpm.value * 1000)
// with BPM = 80 we have 60/80000 = 0.00075

:

delay: Number - , . 20 . 60 , 16,6 .

, 750 , 0.00075 .

, SWF BPM 60, , , bpm.value .


, swf - metronomeonline ( ) BPM, .

0

All Articles