Skip to main content
Participating Frequently
January 3, 2017
Answered

can't get gotoAndPlay work in HTML canvas

  • January 3, 2017
  • 1 reply
  • 500 views

on 1st frame of stage I have a symbol on the canvas.  The symbol has a this.stop(); on first frame of it. 

How can I get this to play from code on stage? 

this.symbolName.gotoAndPlay(2);  //doesn't work

var self = this;

self.symbolName.gotoAndPlay(2) // doesn't work

What am I doing wrong?

This topic has been closed for replies.
Correct answer ClayUUID

Did you actually name your symbol instance "symbolName"?

If you do console.log(self.symbolName) does it display the symbol or undefined?

Do you understand that in a Canvas document gotoAndPlay(2) will actually go to the third frame of a clip?

If your gotoAndPlay code is on the same frame where the clip first appears, it will fail because the clip hasn't fully initialized yet.

1 reply

ClayUUIDCorrect answer
Legend
January 3, 2017

Did you actually name your symbol instance "symbolName"?

If you do console.log(self.symbolName) does it display the symbol or undefined?

Do you understand that in a Canvas document gotoAndPlay(2) will actually go to the third frame of a clip?

If your gotoAndPlay code is on the same frame where the clip first appears, it will fail because the clip hasn't fully initialized yet.

Participating Frequently
January 4, 2017

The code was on the same frame as where the clip first appears.  I didn't know this was how it worked.  Thank you