Skip to main content
Participant
January 19, 2021
Answered

Playing the timeline from javascript

  • January 19, 2021
  • 1 reply
  • 1163 views

Hi all,

I'm currently trying to play the timeline from an animate project from it's parent webpage/document. I used ot be able to do this with edge animate by with a simple

 

sym.play();

 

I've checked through the posts on here and none of the solutions I've found seem to work for me. this.gotoAndPlay(0), just gives me a console error saying the function doesn't exist. Am I missing something obvious, the trigger I'm using to fire the function is working fine but I just can't seem toget the timeline to play.

 

Many thanks in advance.

This topic has been closed for replies.
Correct answer kglad

you have a function in an animate fla canvas project, correct?

 

that function is being called by something somewhere (that probably lacks a reference to the "this" you want) and you've confirmed that function is being called, correct?

 

if so, in the same frame as that function add:

 

var _this=this;

 

and change your code to:

 

_this.gotoAndPlay(0).

1 reply

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
January 19, 2021

you have a function in an animate fla canvas project, correct?

 

that function is being called by something somewhere (that probably lacks a reference to the "this" you want) and you've confirmed that function is being called, correct?

 

if so, in the same frame as that function add:

 

var _this=this;

 

and change your code to:

 

_this.gotoAndPlay(0).

Participant
January 19, 2021

Thanks for the quick response!

 

I was putting the function( and the event listener) directly into the project.js file after publishing it. I didn't think to put it on the frame itself. That has worked!

 

Many thanks.

 

 

kglad
Community Expert
Community Expert
January 19, 2021

you're welcome.