PDA

View Full Version : Previous and Next Frame Labels




phadam
Aug 24, 2009, 06:41 PM
Can someone tell me if my as3 is correct on this? Inside my page I have a previous and back button to take the user to images. 4 images total on my page.



nextBtn.addEventListener(MouseEvent.CLICK, nextSection);
prevBtn.addEventListener(MouseEvent.CLICK, prevSection);

function nextSection(event;MouseEvent):void{

var thisLabel:String = pages.currentLabel;
var thisLabelNum:String = thisLabel.replace("sct","");
var curNumber:Number = Number(thisLabelNum);
if (curNumber < 4{

var nextNum:Number = curNumber + 1;
pages.gotoAndStop("sct"+ nextNum):

}

}

function prevSection(event:MouseEvent):void{

var thisLabel:String = pages.currentLabel;
var thisLabelNum:String = thisLabel.replace("sct","");
var curNumber;Number(thisLabelNum);



angelwatt
Aug 24, 2009, 07:02 PM
Can't speak for all the code, but your if statement is missing a closing parenthesis.

if (curNumber < 4) {

phadam
Aug 24, 2009, 09:43 PM
aaahhh that one snuck by me. thanks!