flash cs4 countdown clock
hi there I have a flash cs4 countdown clock but I want to play a sound w开发者_JAVA百科hen timer reaches hours 0, minutes 0, seconds 0. e.g. New Years Day as target time any ideas?
p.s this is using actionscript 3
var delay:uint = calculate time that is left to newyear in milliseconds var timer:Timer = new Timer(delay, 1); timer.addEventListener(TimerEvent.TIMER_COMPLETE, newYearCallback);
function newYearCallback(e:TimerEvent):void
{
playYourSound();
}
I have built a couple of different timer applications in Flash and I must tell you that Flash's timing isn't perfect... I have always encountered drift even over as short a time span as several minutes.
But if you do feel so compelled... Check the responses here: Add days to Date in ActionScript
And to play the sound, try something like:
var sound:Sound = new Sound();
sound.attachSound("mySound");
sound.start(0,0);
精彩评论