Navigating backwards on timeline

Explorer ,
Jan 24, 2021 Jan 24, 2021

Copy link to clipboard

Copied

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

Views

49

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 25, 2021 Jan 25, 2021

Copy link to clipboard

Copied

LATEST

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?

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines