timerevent in html5 canvas
Good day,
I am trying to do dynamic text. When I press button, it will start to increase or decrease, or implement function according to value?
I used to do this AS3 but I can not do it in html5 canvas document.
How can I use a timer event in html5 canvas document?
Is there a list of all these functions in html5 canvas?
some example in AS3, I need in html5 canvas
import fl.motion.MotionEvent;
var sayacTimer:Timer=new Timer(100);
sayacTimer.addEventListener(TimerEvent.TIMER,colsayac);
var sayac:Number=4;
function colsayac(evt:TimerEvent):void {
sayac-=.08;
sayac=(Math.round(sayac*100))/100;
sayac_txt.text=String(sayac);
if(sayac==-30)
{
sayacTimer.stop();
}
}
play_btn.addEventListener(MouseEvent.CLICK,startTimer);
stop_btn.addEventListener(MouseEvent.CLICK,stopTimer);
function startTimer(evt:MouseEvent):void {
sayacTimer.start();
}
function stopTimer(evt:MouseEvent):void {
sayacTimer.stop();
}
