Help setting up back navigation button by label name.
Newbie back for some gems of wisdom.
I am trying to get forward and back buttons to advance the user along the timeline by label name. I got the forward button to work, but can't seem to find the right code tweakage to get the back button to work.
Here is what I have:
stop();
var myLabels:Array = [ "A","B","C","D","E","F","G","H" ];
var nextLabel:String;
var inc:int = 1;
var prevLabel:String;
var inc2:int = -1;
fwdbtn.addEventListener(MouseEvent.CLICK, clickNextSection);
function clickNextSection(e:MouseEvent):void
{
nextLabel = String(myLabels[inc]);
gotoAndPlay(nextLabel);
inc++;
}
bkbtn.addEventListener(MouseEvent.CLICK, clickPreviousSection);
function clickPreviousSection(e:MouseEvent):void
{
prevLabel = String(myLabels[inc2]);
gotoAndPlay(prevLabel);
inc2++;
}
I'm sure there are some reduncies and I know I'm missing the variable that tells the timeline to subtract positioning from the array.
Do I need to define a new array for the back button?
Any idea what I'm messing up??
Thanks!!
