Skip to main content
francescot
Inspiring
January 24, 2021
Question

Navigating backwards on timeline

  • January 24, 2021
  • 1 reply
  • 250 views

Hello,

I'm having an issue with going backwards on a movie clips own timeline.

The forward button moves timeline to the right frame, the second on that frame will not return it back.

I've tried both the follwoing codes:

var _this = this;

_this.back_bt.on('click', function(){

_this.gotoAndPlay(10);
this.back_bt.addEventListener("click", fl_ClickToGoToAndStopAtFrame.bind(this));

function fl_ClickToGoToAndStopAtFrame() {
	
	this.gotoAndStop(0);

}

 The forward button is exactly like the first bit of code, takes the mc to frame 24.

Not sure if this is causing the issue but the mc in question is loaded from library.

Thanks

    This topic has been closed for replies.

    1 reply

    francescot
    Inspiring
    January 25, 2021

    Think I've figured it out:

    Forward button as follows 

    var _this = this;
    /*
    Stop a Movie Clip/Video
    Stops the specified movie clip or video.
    */
    _this.stop();
    
    
    var _this = this;
    /*
    Clicking on the specified symbol instance executes a function.
    */
    _this.move_bt.on('click', function(){
    /*
    Moves the playhead to the specified frame number in the timeline and stops the movie.
    Can be used on the main timeline or on movie clip timelines.
    */
    _this.gotoAndStop('forward');
    });

    Back button as follows:

     

    var _back = this;
    /*
    Clicking on the specified symbol instance executes a function.
    */
    _back.back_bt.on('click', function(){
    /*
    Moves the playhead to the specified frame number in the timeline and stops the movie.
    Can be used on the main timeline or on movie clip timelines.
    */
    _back.gotoAndPlay('back');
    });

    Seems the the gotoAndPlay and gotoAndStop needed to be in different positions. 

    I'm not sure this is the most elegant solution or correct procedure but I have it work as desired.

    Maybe a show/hide method would be better for html5?