Answer the question
In order to leave comments, you need to log in
How to insert a timer into a text field?
I have this code:
btn_play.addEventListener(MouseEvent.CLICK, playyer);
btn_stop.addEventListener(MouseEvent.CLICK, stopper);
var tiktak: String = "часики тикают";
var netik: String = "пауза";
current_txtf.text = tiktak;
function stopper (event:MouseEvent):void
{
btn_stop.visible = false;
btn_play.visible = true;
current_txtf.text = netik;
stop();
}
function playyer (event:MouseEvent):void
{
btn_stop.visible = true;
btn_play.visible = false;
current_txtf.text = tiktak;
play();
}
Answer the question
In order to leave comments, you need to log in
you need a procedure that will run from a timer or thread. I don’t really understand what kind of SP you have, but it looks like JavaScript.
For JS, you need to create a function that will increment the counter and output it to the field.
In playyer, instead of modifying a variable, you need to write code to start the setTimeout or setInterval timer. And in stopper you need to write a clearTimeout or clearInterval call. There are still nuances that the timer needs to be restarted again in its function. And it is even better to read the help with examples about these functions.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question