Noob AS3 Button question.
Hey, I have two buttons and here is my code:
import flash.events.MouseEvent;
stop();
B1.addEventListener(MouseEvent.CLICK, onB1Click);
B2.addEventListener(MouseEvent.CLICK, onB2Click);
//this will give you the hand cursor on rollover:
//now to handle the incoming click events
function onB1Click(e:MouseEvent):void
{
if (this.currentFrame < this.totalFrames)
{
this.gotoAndStop(this.currentFrame + 1);
trace('B1 Clicked: moved to next frame (' + this.currentFrame + ')\n');
}
else
{
trace('B1 Clicked: you are on the last frame already.\n');
}
}
function onB2Click(e:MouseEvent):void
{
if (this.currentFrame > 1)
{
this.gotoAndStop(this.currentFrame - 1);
trace('B2 Clicked: moved to previous frame (' + this.currentFrame + ')\n');
}
else
{
trace('B2 Clicked: you are on the first frame already.\n');
}
}
Can Somebody tell me why this isn't working?
If anyones interested, here is a link to my flash file:
http://uploading.com/files/968cee24/Photo%2Bgallery%2B2.fla/
Thanks.