Copy link to clipboard
Copied
Doing a project and having some doubts. As yesterday I asked around something and I got to know a lot of new things I didn't thought before and as I'm still learning, I'm now trying to make a 10 minute countdown.
My question is not exactly for you to solve my problem, but how I can understand how to make it work based on what I know for now!
I've used some codes from forums and other youtube tutorials and random links I found on google (some of them outdated). But I can't make it work. I've tried with an empty textbox with a instance name I call on my code, it doesn't work. I've tried to make also a textbox with some other kind of code based on a date countdown I found... Also doesn't work.
I'm using Adobe Animate but I think I'm doing a wrong approach.
Am I doing something wrong? I have like more than 10 tabs opened with this question... Which kind of script I need to make it work?
Can you teach me the difference between these scripts?
var time_duration_ms:int = 10*60*1000;
var startTime:Number;
startTimer()
function startTimer():void{
startTime = new Date().time;
this.addEventListener(Event.ENTER_FRAME,timeF);
}
function timeF(e:Event):void{
// display whatever - ? format_as timeF(new Date.time-startTime); // define format_as_timeF
if(new Date().time>=startTime+time_duration_ms){
this.removeEventListener(Event.ENTER_FRAME,timeF);
endTimer()
}
}
function endTimer():void{
// do whatever
}
Copy link to clipboard
Copied
var time_duration_ms:int = 10*60*1000;
var startTime:Number;
startTimer()
function startTimer():void{
startTime = new Date().time;
this.addEventListener(Event.ENTER_FRAME,timeF);
}
function timeF(e:Event):void{
// display whatever - ? format_as timeF(new Date.time-startTime); // define format_as_timeF
if(new Date().time>=startTime+time_duration_ms){
this.removeEventListener(Event.ENTER_FRAME,timeF);
endTimer()
}
}
function endTimer():void{
// do whatever
}
Copy link to clipboard
Copied
Thank you so much!
But I still can't make it work as I don't know how to properly manipulate that...
Copy link to clipboard
Copied
what can't you get to work?
Copy link to clipboard
Copied
You have failed to mention whether you're working on an AS3 or Canvas project.
Copy link to clipboard
Copied
Try this tutorial. Adobe Flash Tutorial - Count Down Timer - YouTube
Find more inspiration, events, and resources on the new Adobe Community
Explore Now