Animate HTML5 Movie Clip Sending Too Many Browser Alerts
I am using Adobe Animate to make a video with two types of navigation in html5 canvas. One of the two types seems faulty and activates multiple times for an unknown reason. For background, I have a main timeline with navigation and a menu panel (specified as a movie clip) within the main timeline which has its own internal timeline navigation properties.
My basic navigation functions on the main timeline are like the following:
this.back_btn.addEventListener("click", MoveBackMain.bind(this));
function MoveBackMain(){
if (this.currentFrame > 2){this.gotoAndStop(this.currentFrame-1);
document.getElementById('PageText').value = String(this.currentFrame-1);}
else {alert('You are at the beginning');}
}This works fine. When I get to the beginning, I get a single notice that I am at the beginning. There is a similar type of notification with my forward button that give me a single notice when I reach the end.
Within the menu, however, I have more issues with the timeline. I made the menu into a movie clip so that I could specify different pages of options on the timeline. I want the user to know when they are at the beginning of the options and when they are at the end. All of the buttons in the menu have different instance names than the buttons on the main timeline. The menu’s code’s structure is very similar:
var = framenmr
framenmr =0
this.menu_back_btn.addEventListener('click', MoveBackMenu.bind(this));
function MoveBackMenu(){
if (framenmr > 0){this.gotoAndStop(framenmr-1);
framenmr = framenmr-1;} else {
alert('This is the first page of options.');}
}
This works fine the first time I access the menu and navigate through its timeline, but after the first time, if I go forward and then back again, then I get two consecutive browser alerts. If continue navigating after this and repeat the process, then I get three consecutive browser alerts. The number of alerts that I get keeps increasing the more I navigate back and forth through the menu, but this is never an issue on the main timeline.
Does anyone know why movie clip seems to keep track of how many times I have navigated back and forth and how to stop this behavior?
