• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Flash Action Script 3 help...


#1
Hello!

I have been set an assignment to make a photo viewer with forward and backwards buttons but my code isn't working :/

that is the code ive got but the line it seems to have problems with is the one marked with **

stop ()

btn1.addEventListener (MouseEvent.CLICK, backward);
btn2.addEventListener (MouseEvent.CLICK, forward).

function forward(event:MouseEvent)){ **
if this.currentFrame == this.totalFrames){
gotoAndStop(1);
}
else{
nextFrame();
}
}
function backward(event:MouseEvent){
if this.currentFrame == 1 ){
gotoAndStop(1): this.totalFrames
}
else{
prevFrame();
}
}

any help would be greatly appreciated as I need this completed by monday!

Thank you

:)
xxxx
 
#5
This will work:

stop ()

btn1.addEventListener (MouseEvent.CLICK, backward);
btn2.addEventListener (MouseEvent.CLICK, forward);

function forward(event:MouseEvent)
{
if (this.currentFrame == this.totalFrames){
gotoAndStop(1);
}
else{
nextFrame();
}
}

function backward(event:MouseEvent)
{
if (this.currentFrame == 1 ){
gotoAndStop(this.totalFrames);
}
else{
prevFrame();
}
}