Skip to main content
Known Participant
May 14, 2009
Answered

alternate click states

  • May 14, 2009
  • 1 reply
  • 852 views

I have a project whose buttons animate pretty heavily on interaction. So, when you mouse over a button, it increases in scale, and has two states per button – i have figured that out with your help.

My next big question, pertains to the orange buttons found in the "let me" explore section of this site:

www.straightlinenyc.com/introduction/launch.html

If you mouse over the orange buttons (only the ones that pop alone, if they pop with another bubble somewhere, those are the wrong ones) it pops up with the appropriate words inside, as you see, when you click on these, they change to give you a definition of that word, and when you click again it goes back.

I guess my question is, should i use a boolean to accomplish this? the click state change makes sense to me, but the second click is kind of throwing me for a loop.

I just need some help in how to approach these? If i was not clear enough, just let me know, and i will try to be more specific.

This topic has been closed for replies.
Correct answer kglad

use a movieclip button with a (boolean) toggle:

mc.addEventListener(MouseEvent.CLICK,f);

function f(e:MouseEvent){

if(!e.currentTarget.toggle){

//do whatever

} else {

//do whatever else

}

e.currentTarget.toggle=!e.currentTarget.toggle;

}

1 reply

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
May 14, 2009

use a movieclip button with a (boolean) toggle:

mc.addEventListener(MouseEvent.CLICK,f);

function f(e:MouseEvent){

if(!e.currentTarget.toggle){

//do whatever

} else {

//do whatever else

}

e.currentTarget.toggle=!e.currentTarget.toggle;

}

bamaurerAuthor
Known Participant
May 14, 2009

spectacular, thanks k!

kglad
Community Expert
Community Expert
May 14, 2009

you're welcome.