Back and forward using arrays

i found a tech note on macromedia about creating a back button within flash, and using an array to “remember” your history. it works really well, but my question is, how would one alter it to add a forward button.

here is the code from the tech document.

in my project, let’s say i have 4 keyframes on the main timeline. on the first frame, this code appears:

navStack = [];

on the next 3 frames, this code appears:


on the stage there is a button with this code on it.

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

i’ve added the trace and you can see how it works. pretty slick. i’d like to add a forward button. anyone have any examples or thoughts on how to approach this.