Help with gotoAndPlay()
- August 11, 2020
- 1 reply
- 842 views
Good Morning,
I am pretty new to Adobe Animate and I seem to have run into an issue that I don't understand.
I have an environment animated panning left and right and I want the user to be able to click on an arrow to then play the animation to pan in the direction they wanted. The attached image is how my Timeline is set up.
Frame 1 is blank and just a white screen, and the code on the Scripts Layer is;
this.gotoAndStop("Part01");
This works the way I expect it, it immediately moves to the start of my Part 01 section and stops.
Now on Frame 2 (the start of my Part 01 section) of the Scripts Layer I have this code;
this.LeftArrow.alpha = .5;
this.RightArrow.on("click", function(){
console.log ("Move Right");
this.gotoAndPlay("Part01");
})
It starts off making my LeftArrow Button grayed out to indicate that you can't move anymore in that direction, then if the RightArrow Button is clicked it should Play my Part01 animation to move to the right, but it doesn’t.
It displays Move Right in my Console, so I know the function is being called, and it gives no errors at all, it just does nothing and I don't know why. I don't know if my logic is faulty, or if I am using the wrong function, or if it is just Chrome being a jerk...
Any help would be greatly appreciated, thank you.
--Jeff
