Skip to main content
warpigs666
Inspiring
July 19, 2019
Answered

How to prevent this animation from looping?

  • July 19, 2019
  • 1 reply
  • 968 views

Hi. I have the following code that I wrote with help from forum members. I'm still working the bugs out. Here is the code from Frame 1(0). One of the problems is that  when the nextBtn animates onto the screen after the video ends, it slides into the frame using a tween, and then you can hover over it and it changes colors and then you click it to advance to the next frame. However, once you hover over it if you then move off it the tween animation is re-triggered. I tried setting the properties panel from loop to only play once but it didn't help. Any ideas how I could fix this?

this.stop();

var nextBtnVAR = this.nextBtn;

var timelineVAR = this;

this.stopBtn.addEventListener("click", stopVideoFUNC.bind(this));

function stopVideoFUNC()

{

$("#video1")[0].pause();

$("#video1")[0].currentTime = 0;

this.pauseBtn.visible = false;

}

this.playBtn.addEventListener("click", playVideoFUNC.bind(this));

function playVideoFUNC()

{

$("#video1")[0].play();

this.pauseBtn.visible = true;

}

this.pauseBtn.addEventListener("click", pauseVideoFUNC.bind(this));

function pauseVideoFUNC()

{

$("#video1")[0].pause();

this.pauseBtn.visible = false;

}

this.nextBtn.addEventListener("click", nextFrameFUNC.bind(this));

function nextFrameFUNC()

{

this.gotoAndStop(2);

}

this.video1.on("added", function()

{

$("#video1")[0].addEventListener('ended', timelineVAR.endedHandler);

}

);

this.endedHandler = function(e)

{

timelineVAR.gotoAndStop(1);

timelineVAR.pauseBtn.visible = false;

};

    This topic has been closed for replies.
    Correct answer kglad

    you have movieclips in the over and out 'frames' of your nextBtn?

    1 reply

    kglad
    Community Expert
    kgladCommunity ExpertCorrect answer
    Community Expert
    July 21, 2019

    you have movieclips in the over and out 'frames' of your nextBtn?

    warpigs666
    Inspiring
    July 21, 2019

    Yeah 'up' too. I guess I was conceptualizing this wrong.

    kglad
    Community Expert
    Community Expert
    July 22, 2019

    you should experiment to determine what you want to happen.  right now it's not clear what (up, over and maybe down) tween animation is occurring that you do not want.