Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Can't make countdown work?

New Here ,
Nov 29, 2017 Nov 29, 2017

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?

517
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Nov 29, 2017 Nov 29, 2017

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

}

Translate
Community Expert ,
Nov 29, 2017 Nov 29, 2017

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

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 29, 2017 Nov 29, 2017

Thank you so much!

But I still can't make it work as I don't know how to properly manipulate that...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 29, 2017 Nov 29, 2017
LATEST

what can't you get to work?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 29, 2017 Nov 29, 2017

You have failed to mention whether you're working on an AS3 or Canvas project.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 29, 2017 Nov 29, 2017
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines