# Back/Forward buttons inside fla. Help?

**URL:** <https://forum.kirupa.com/t/back-forward-buttons-inside-fla-help/270098>\
**Category:** Uncategorized\
**Created:** [September 5, 2008, 4:19am UTC](https://forum.kirupa.com/t/back-forward-buttons-inside-fla-help/270098 "2008-09-05T04:19:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![54321](https://avatars.discourse-cdn.com/v4/letter/5/7993a0/32.png) [@54321](https://forum.kirupa.com/u/54321)\
**Post date:** [September 5, 2008, 4:19am UTC](https://forum.kirupa.com/t/back-forward-buttons-inside-fla-help/270098/1 "2008-09-05T04:19:39Z")

</div>

Hey guys,

I can’t seem to find a code/tutorial for an actionscript “back button”

So… essentially what I want to do is have something (an array??) that collects data on where a user has gone… what frames they have visited. and then have a back and forward button that looks to see where they’ve gone and sends 'em to the latest one.

I found a tutorial for this at adobes site, but it’s in as2 ☹

[http://kb.adobe.com/selfservice/viewContent.do?externalId=tn\_14831](http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_14831)  
here’s what that link has:

navStack = [];  
navStack.push(\_currentFrame);

on (release) {  
if (\_root.navStack.length \> 1) {  
recentFrame = \_root.navStack.pop();  
previousFrame = \_root.navStack.pop();  
goToAndPlay(previousFrame);  
}  
}

and then a guy who is helping me out that came up with this:

var navStack:Array = new Array();

navStack.push(this.currentFrame);

myBtn.addEventListener(MouseEvent.CLICK, myBtnClick);

var recentFrame:uint;  
var previousFrame:uint;  
function myBtnClick(event:MouseEvent):void {  
if (navStack.length \> 1) {  
recentFrame = navStack.pop();  
previousFrame = navStack.pop();  
gotoAndPlay(previousFrame);  
}  
}

^^^ that one doesn’t bring up any errors, but doesn’t do anything either as far as I can tell.

I really appreciate it guys!
