PDA

View Full Version : button with two states on/off it switches between


Valfreyja
10-22-2001, 12:35 AM
I need a button that has the two states on and off and switches between those two when clicked.
(when in the state off it is turned on and the oposite)

Can anyone help me with this? - I have not been able to find any examples anywhere that could help me getting started.


If the first is fairly simple the next step would be to make a timer that tells me how long time the button was on.
If this is very difficult I will just stick to the first.

Thank you in advance

Valfreyja

Jesse
10-22-2001, 05:23 AM
The concept is that you have a 2 frame MC with 2 separate buttons. Both frames have a stop action and frame 1 has a button with a gotoAndStop(2) action. Frame 2 contains a button which looks like the down state so that when the button is pressed it 'sticks' down... Frame 2's button has gotoAndStop(1)... you can use getTimer() which states how long the movie has been running for to determine the down time. Frame 1's button woul dhave something like:
on (release) {
this.gotoAndStop(2);
startTime = getTimer();
}
and frame 2's button would have:
on (release) {
this.gotoAndStop(2);
timeDown = getTimer() - startTime;
}

Valfreyja
10-22-2001, 10:13 AM
Thank you Jesse

But how do I check if I am in the "on" state or "off" state.
I will have to know 'cause when I click the button it will have to change state.

Sorry if this is already incorporated in the solution you gave me but I am a true newbie at this *grins*

orox
10-23-2001, 02:32 AM
button with two states on/off it switches between

Valfreyja
10-23-2001, 05:07 PM
Thanks oro
I will go look at that :)