PDA

View Full Version : Help with buttons


Drumpie
02-03-2010, 04:08 PM
Hello ,

I have a problem with my actionscript button, and I'm kind of new with actionscript.

This is the kind of code I put down each frames. It reprensent where you have to go when you press the button.


back_btn.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler47);function mouseDownHandler47(event:MouseEvent):void {

gotoAndStop(246);

}
next_btn.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler48);function mouseDownHandler48(event:MouseEvent):void {

gotoAndStop(232);

}




I could not send you my file so you can check my button problem.
But I can send it to you via email, on demand. As I want a proper back and next button, I don't know what to do in purpose of having no cicle bugs.

Thank you,

Liz

flashGeneral
02-03-2010, 04:38 PM
Is this what your looking to do?
stop();

previous_btn.addEventListener(MouseEvent.CLICK, previousClick);
next_btn.addEventListener(MouseEvent.CLICK, nextClick);

function previousClick(event:MouseEvent):void {
gotoAndStop(currentFrame -1);
}
function nextClick(event:MouseEvent):void {
gotoAndStop(currentFrame +1);
}

Drumpie
02-03-2010, 05:14 PM
No actually,
I've put those frames because it's not forwarding or going back on the nearest frame.


My buttons are functionning, but after a number of time that I pressed them it has to go back at the beginning of the cycle. Right now, at the end of the cycle, when I want to get back at the beginning and redo de cycle, it doesn't work. I'm not sure it's a problem with the actual code ....

foward me an email adress where I can send my .swf

flashGeneral
02-03-2010, 05:50 PM
On the last frame of the last cycle put:
gotoAndStop(1);
1 or the frame you want to start again.

flashGeneral
02-03-2010, 06:00 PM
or use an if statement on your button function:
if(currentFrame == 500){
gotoAndStop(1);
}
500 being the the last frame.
Hope this helps.

Drumpie
02-03-2010, 06:02 PM
This is logically what I've done,
but it doesn't work. It always eventually bug, like it doesn't want to do what it has already done.

Drumpie
02-03-2010, 06:14 PM
I'd like to send my .swf