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

setInterval function to refresh new Date?

New Here ,
May 17, 2023 May 17, 2023

Copy link to clipboard

Copied

Hello, I apologize if this question has already been posted...  I'm trying to make a basic time/date in Animate.  If I use this.tf.text = new Date();  where tf is a dynamic text field, the .fla displays what I want.  My question is, is it possible to put this in a function and then use setInterval to essentially get a real time display?  If so, can someone help with the code?  I'm a mechanic by trade and hitting it with a hammer isn't working....

Views

249

Translate

Translate

Report

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 ,
May 17, 2023 May 17, 2023

Copy link to clipboard

Copied

any loop will work.

 

setInterval(updateF.bind(this),500);

 

function updateF(){
this.tf.text=new Date();  // you'll probably want to format this

}

Votes

Translate

Translate

Report

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 ,
May 18, 2023 May 18, 2023

Copy link to clipboard

Copied

Works beautifully, thank you!

Votes

Translate

Translate

Report

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 ,
May 18, 2023 May 18, 2023

Copy link to clipboard

Copied

LATEST

you're welcome.

Votes

Translate

Translate

Report

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