Having issues with coding in HTML5 for making a looping menu in a choose-your-own-adventure game
So the idea is to make a menu with a classic tween animation that will fade in the title screen and the start button and then, after passing a certain number of frames, would fade to black. Afterwards, it'll loop back to the beginning and start over again until the player clicks the start button. The issue I'm having is that the button will appear only when it first starts, it disappears after it loops.
Heres the run down:
By frame 119, I have the button already faded in and programed to jump to frame 238 to start the game. I labeled the frames that the button is programmed to jump to for the sake of ease incase if I have to move the code to a different frame so heres the labels I used so heres the labels and their frame numbers: "Title=frame 1", "start=frame 119", "after_start= frame 238"
Heres the code:
Frame 119:
/* Click to Go to Frame and Play
Clicking on the specified symbol instance moves the playhead to the specified frame in the timeline and continues playback from that frame.
Can be used on the main timeline or on movie clip timelines.
Instructions:
1. Replace the number 5 in the code below with the frame number you would like the playhead to move to when the symbol instance is clicked.
2.Frame numbers in EaselJS start at 0 instead of 1
*/
this.start.addEventListener("click", fl_ClickToGoToAndPlayFromFrame.bind(this));
function fl_ClickToGoToAndPlayFromFrame()
{
this.gotoAndPlay("after_start");
}
Frame 238:
/* Stop at This Frame
The timeline will stop/pause at the frame where you insert this code.
Can also be used to stop/pause the timeline of movieclips.
*/
this.stop();
/* Click to Go to Frame and Play
Clicking on the specified symbol instance moves the playhead to the specified frame in the timeline and continues playback from that frame.
Can be used on the main timeline or on movie clip timelines.
Instructions:
1. Replace the number 5 in the code below with the frame number you would like the playhead to move to when the symbol instance is clicked.
2.Frame numbers in EaselJS start at 0 instead of 1
*/
this.trigger.addEventListener("click", fl_ClickToGoToAndPlayFromFrame_2.bind(this));
function fl_ClickToGoToAndPlayFromFrame_2()
{
this.gotoAndPlay("title");
}
Any suggestion on having the button loop with the rest of the menu?