|
-
.
Hi,
Here is one that remembers all pages visited and stores them in an array, then removes it from the array as you go back, perhaps this is more of what you desire, play around with it.
actually I changed the code on that file, here it is, if you wish to swap it for this code.
PHP Code:
stop();
import flash.events.MouseEvent;
var i:Number; var firstRun:Boolean;
var currentPage:Number; var pageArray:Array; var buttonArray:Array;
if (! firstRun) { currentPage = 1; firstRun = true; pageArray = new Array(); pageArray.push(currentPage); buttonArray = new Array(button1,button2,button3,button4,button5); for (i = 0; i < buttonArray.length; i++) { var pageButton:Object = buttonArray[i]; pageButton.value = (i + 1); pageButton.numText.text = (i + 1); pageButton.addEventListener(MouseEvent.CLICK, doPage); } backButton.addEventListener(MouseEvent.CLICK, goBack); stage.addEventListener(Event.ENTER_FRAME, showHide); }
function showHide(e:Event):void { if (pageArray.length > 1) { backButton.visible = true; } else { backButton.visible = false; } }
function doPage(e:MouseEvent):void { currentPage = e.currentTarget.value; pageArray.push(currentPage); gotoAndStop(currentPage); }
function goBack(e:MouseEvent):void { if (pageArray.length > 1) { pageArray.pop(); gotoAndStop(pageArray[pageArray.length - 1]); } }
Last edited by fruitbeard; 02-04-2015 at 11:49 AM.
-
Looks good, I will try this once I get home from work and will post my file then as well.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|