Back/Forward buttons inside fla. Help?

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 :frowning:

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!