PDA

View Full Version : Smart Buttons


Dachef
01-08-2001, 10:59 AM
ok I have been working on an actionscript that destroys that annoying button reclick problem, so commonly found.
Basically i want to have it so if a button is clicked twice..the animation that takes place does not repeat itself. I thought i could do this with variables.

I just started using Flash 5. this might be an easy question, or a simple mistake on my part. but go easy on me.

in the first frame of my movie i have a set variable action that sets the variable x to 0. it looks like this:

x = 0;

in the first button i have the following:

on (release) {
if (x = 1) {
tellTarget ("mc") {
stop ();
}
} else {
tellTarget ("mc") {
gotoAndPlay (2);
x = 1;
}
}
}


what am i doing wrong..and how can i fix it. or if i am going about it the wrong way..what can i do..

i appreciate your help.

Dachef

jake88
01-08-2001, 06:54 PM
Try this, instead of setting the variables to the buttons, set it to the movie clip. let's say you have the button that expands from frame 1-10 and then retracts from frame 11-20. so on the following frames you put:

frame 1 - x=0;
frame 2 - x=1;
frame 10 - x=2;
frame 11 - x=3;
frame 20 - gotoAndPlay (1);


now on the button you put:


on (release) {
if (x==0) {
gotoAndPlay (_currentframe1+1);
} else if (x==1) {
gotoAndPlay (_currentframe1);
} else if (x==2) {
gotoAndPlay (11);
} else if (x==3) {
gotoAndPlay (_currentframe1);
}

}


I'm sure there is a much better way, but I didn't have too much time to fool around with it. Hope that helps.

Dachef
01-09-2001, 05:18 AM
thanks..i will try that today.