Note that there are some explanatory texts on larger screens.

plurals
  1. POAS3 Timer out of sync on reload
    primarykey
    data
    text
    <p>I'm creating a sequence of animations that run while an audio clip is being played. I trigger these sequences by using a <strong>TimerEvent.TIMER</strong> event every 1000 milliseconds. Then using the <strong>Date class</strong> I convert the <strong>SoundChannel.position</strong> into <em>seconds and minutes</em> and I detect the appropriate time from the <em>seconds and minutes</em> to play the sequence in order to flow with specific times in the audio clip.</p> <p>The method I thought would be effective....However, sometimes and very rarely when I "reload" the swf I get these weird overlapping of the sequences sometimes not playing in order or playing out of time( this is of course after everything is already preloaded). </p> <p>What could be causing this? What would be a better solutions besides doing frame by frame animation?</p> <p>My code looks like this..</p> <pre><code>timer.addEventListener(TimerEvent.TIMER, function(e:TimerEvent){ var d:Date = new Date(0,0,0,0,0,0,channel.position); switch(true) { case d.getMinutes() == 0 &amp;&amp; d.getSeconds() == 8 : addText(phrases.shift(),237,122); break; case d.getMinutes() == 0 &amp;&amp; d.getSeconds() == 15 : addText(phrases.shift(),20,126,22); break; case d.getMinutes() == 0 &amp;&amp; d.getSeconds() == 16 : removeChild(texts.shift().parent); slides.slideShow(); var tween:Tween = new Tween(texts[0],"y",Strong.easeOut,texts[0].y, 63,3,true); tween.addEventListener(TweenEvent.MOTION_FINISH,function(){ addText(phrases.shift(),181,100,22); setTimeout(function(){ addText(phrases.shift(),181,129,42,true); }, 150); }); break; case d.getMinutes() == 0 &amp;&amp; d.getSeconds() == 22 : removeChild(texts.shift().parent); break; case d.getMinutes() == 0 &amp;&amp; d.getSeconds() == 23 : slides.slideShow(); break; case d.getMinutes() == 0 &amp;&amp; d.getSeconds() == 24 : removeChild(texts.shift().parent); break; case d.getMinutes() == 0 &amp;&amp; d.getSeconds() == 25 : </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload