On/off button

hey!
I’m going to make two buttons, one red and one white! When I press the white button, it turns red, and the other button goes white!.. there must be an easy way!??

You might have the instances mixed up. Can you post your code for both buttons?

I think what he means is that the buttons are <I>supposed</I> to swap colours when you click on them. Is that right?

Exactly!

…the action for the “on-button” is:

on (release) {
tellTarget (“eyemask”) {
gotoAndPlay(9);
}
}

and the off-button:

on (release) {
tellTarget (“eyemask”) {
gotoAndPlay(4);
}
}

I replied to a button colour changing problem a while ago:

http://www.kirupaforum.com/showthread.php?s=&threadid=5850&highlight=button

I’ll do a fla for changing to buttons colours and post it when I have a sec.

So you want, when one button is pressed, to turn white, and the other to go red?

Or if you could post you fla, I’ll modifiy it…

Well, it’s a very large .fla file, so it would be very NICE if you could make me a tiny example and post it! …thx for helping out!

…and yes, when one button is pressed, to turn white, and the other to go red!

it’s text buttons!

ewww tell target…
What version of flash u using?

hehe… i’m using MX

maybe thats why ur on the MX forum…lol

Why are u using tell target? hehe :slight_smile:

Well, perhaps it’s a OLD bad habbit from my flash 5 days! :nerd:

Hi, I’m posting the fla for you. I have added a variable so that you can’t click the off button until you’ve clicked the on button, and vice versa. Let me know if that’s what you wanted

Great!!!

thx alot m8, I really appreciate it!

yo flex - it get an error when trying to linking the buttons!

“[COLOR=red]Target not found: Target=“eyemask” Base=”_level0.but1[/COLOR] "

this is the action:
[COLOR=royalblue]
on (press) {
tellTarget (“eyemask”) {
gotoAndPlay(9);
}
}
on (release) {
if (!_root.swapped) {
_root.swapped = true;
this.gotoAndPlay(“red1”);
_root.but2.gotoAndPlay(“white2”);
}
}[/COLOR]

Well the fla I posted works 100%. As for your actions for [COLOR=blue]on (press)[/COLOR] I have no way of verifying them because I can’t see the structure of your movie!

I take it the buttons are fine, but you also want to tell an mc (I presume) called “eyemask” to go and play frame 9. I would suggest you put a frame label on frame 9 called, for example “thisplace”. Then if you want all the actions happening together, just use:

[COLOR=blue]on (release) {
if (!_root.swapped) {
_root.swapped = true;
this.gotoAndPlay(“red1”);
_root.but2.gotoAndPlay(“white2”);
_root.eyemask.gotoAndPlay(“thisplace”);
}
}[/COLOR]

Unless you specifically need seperate actions for on press and on release.

Also depends where eyemask is located, ie. whether it’s nested in another movie clip (or other movie clips).

hehehe tell target was depriciated in flash 5 too…

Yes, I thought you had taken Bezzer’s advice and replaced the tell target action. It will save re-editing your actionscript in the future.