Skip to main content
Participant
August 12, 2018
Answered

Countdown to a date: Syntax and loading issue

  • August 12, 2018
  • 2 replies
  • 620 views

I am having issues loading (browser) the JavaScript assigned to a text field in Adobe Animate CC.

The code is as follows

---------------

var specific_d=new Date(2018, 8, 24);

createjs.Ticker.addEventListener("tick"tickF.bnd(this));

function tickF(){

var d=new Date();

this.countdown_txt.text=Math.round((specific_d.getTime()-d.getTime())/(1000*60*60*24))+" days";

}

---------------------

The error messages are (console.log)

Uncaught SyntaxError: missing ) after argument list

and

Uncaught ReferenceError: AdobeAn is not defined

    at init at onload

Thank you in advance,

Andrew

This topic has been closed for replies.
Correct answer andreww97663747

So if I change the date to var specific_d=new Date(2018, 7, 24); It gives me the correct number of days to the 24 August

2 replies

Participant
August 12, 2018

I have picked up the errors

1. ("tick"tickF.bnd(this)); - typo - bind
2. ("tick"tickF.bnd(this)); - typo - "tick",

The stange thing is that the countdown is to September and not August.

var specific_d=new Date(2018, 8, 24);

createjs.Ticker.addEventListener("tick", tickF.bind(this));

function tickF(){

var d=new Date();

this.countdown_txt.text=Math.round((specific_d.getTime()-d.getTime())/(1000*60*60*24))+" days";

}

andreww97663747AuthorCorrect answer
Participant
August 12, 2018

So if I change the date to var specific_d=new Date(2018, 7, 24); It gives me the correct number of days to the 24 August

ankushr40215001
Inspiring
August 13, 2018

Hi Andrew,

So is your issue fixed now, or do we need to look in something else?

Thanks,

Ankush

Participant
August 12, 2018

It's been suggested that

createjs.Ticker.addEventListener("tick"tickF.bnd(this));

is incorrect