Copy link to clipboard
Copied
Hello all
New to Animate CC and believed I was making good progress but I have come up against a problem which I'm unable to solve (after a few hours of trying).
I have a simple animation which I want to the view to start by pressing a button.
I am using a HTML Canvas document (as I intend hosting some animations on my portfolio site)
All the elements to animate on various layers appear on frame 2, with a blank keyframe on frame 1.
The only elements on frame 1 are the background image and also the button. The button only appears on frame 1, and will disappear when the animation begins on frame 2.
The code on frame 1 start with this.stop( )'
This stops the animation from starting and all is good.
The code attached to the button is below:
this.btn.addEventListener("click", fl_MouseClickHandler_2.bind(this));
function fl_MouseClickHandler_2()
{
gotoFrameAndPlay(2);
}
This code was taken largely from the code snippets Event Handlers/Mouse Click Event, and I inserted the line 'gotoFrameAndPlay(2);'
But this does not work??
This seems a simple, common task to achieve but I am having problem with this.
Any help would be really appreciated.
this.btn.addEventListener("click", fl_MouseClickHandler_2.bind(this));
function fl_MouseClickHandler_2()
{
this.gotoAndPlay(2);
}
Copy link to clipboard
Copied
this.btn.addEventListener("click", fl_MouseClickHandler_2.bind(this));
function fl_MouseClickHandler_2()
{
this.gotoAndPlay(2);
}
Copy link to clipboard
Copied
That's great, many thanks.
So it was just a case of placing the word 'this.' before the frame number line.
Should have realised. Appreciate your time.
Copy link to clipboard
Copied
It's also changing gotoFrameAndPlay() to gotoAndPlay(). There is no gotoFrameAndPlay() command.