Html 5 ; button single click first time, - right. Then it needs double click from then on - wrong.
I hope that made sense.
I have an HTML5 project in adobe Animate to play 4 short videos
On frame 0 there are four buttons. When you click a button it goes to another frame, plays the video there, then returns to frame 0. This all works fine.
The problem is after the first time you play a video the button requires two clicks to play the video again.
I have the script on two frames - only because I got it to work that way.
Frame 0 script;
this.stop();
if (!this.EventSurround) {
// this if statement surrounds all the following then declares it to be true.
//NOTE: the "if" closes at the bottom and "EventSurround" is true.
//This stops the event listeners running again at frame 0
this.High_btn.addEventListener("click", High.bind(this));
this.Low_btn.addEventListener("click", Low.bind(this));
this.Dont_btn.addEventListener("click", Dont.bind(this));
this.Know_btn.addEventListener("click", Know.bind(this));
function High() {
this.gotoAndPlay(1);
}
function Low() {
this.gotoAndPlay(2);
}
function Dont() {
this.gotoAndPlay(3);
}
function Know() {
this.gotoAndPlay(4);
}
this.EventSurround = true;
}
and frame 1 script;
this.stop();
if (!this.EventSurround1) {
this.Fig01_vid.on("added", function() {
$("#Fig01_vid")[0].play();
}, this, true);
setTimeout(function()
{
var video = document.getElementById("Fig01_vid"); // "Fig01_vid" is the video component instance name
video.addEventListener("ended", function()
{
exportRoot.gotoAndStop(0);
});
}, 1000); // in some cases this delay may be set to a higher value, like 100, 300...
// !!!!that delay at 1000 returns it back to frame zero!!!!!
}
this.EventSurround1 = true;
}
The frame 1 script is made up of JoaoCesars script from this post;
I suspect that the problem is an event listener remove situation, but everything I try does not work.
Would appreciate any help.
