0

recently i have changed from AS3 to HTML5/javascript and i really; want to know how to make javascript;to put a delay when i click a button to gotoandplay a certain frame after 2 seconds in my timeline.In AS3 was that:

function seatbelt_clicked(e:MouseEvent):void{
    setTimeout(gotoAndPlay, 2100, 2);
}

seatbelt.addEventListener(MouseEvent.CLICK,seatbelt_clicked);

1 Answers1

1

I'm not sure if I completely understand your English, but just to be clear...Y-you don't have frames in javascript or html5. You have...divs I guess. The delay function in java-script can be found here. It's the same as the one you're using from flash.utils

However, if you have arguments in your javascript callback function reference this how-to.

sfxworks
  • 1,031
  • 8
  • 27
  • im working on Adobe animate CC, in actions i have to deal now with Javascript , so i want to make a button which changes frame after 2 seconds from the click. –  Jun 09 '17 at 18:38
  • Sorry then, that's beyond me. I either write my javascript from scratch or program in animate and/or FlashDevelop using AS3. I don't understand how they're merged. IMO you should switch back or draw your graphics using some graphic editor and use a text editor to program them. – sfxworks Jun 09 '17 at 18:40