Skip to main content
February 13, 2016
Question

How to make the button's colour stay the same after being clicked?

  • February 13, 2016
  • 1 reply
  • 1217 views

Hi.

I want to create button which the colour will change when user click to indicate that the button has been chosen.

I've found solution through the previous discussion in this forum.

I've tried but the something lack.

When I click the button, the colour change when I remove my mouse cursor. Then when I roll over my cursor over the button, the first colour will appear.  Again, if I remove the cursor, the colour change to the second colour I've set.

Here is the actionscript I've been using (Adobe Flash Professional CS6, ActionScript 3.0) ;

stop();

hello.addEventListener(MouseEvent.CLICK, fl_ClickToGoToScene);

function fl_ClickToGoToScene(event:MouseEvent):void

{

  hello.upState = hello.downState;

  // to make the button appear to stay down when released

  hello.upState = hello.hitTestState;

  // to reset it, assuming the Hit frame holds the upSate imagery

  //MovieClip(this.root).gotoAndPlay(1, "Scene 2");

}

Hope anyone can help me. Thank you in advance

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
February 13, 2016

change its overState, too

hello.overState=hello.downState

February 13, 2016

Nothing's change. Here is my file Dropbox - BUTTON_CHANGE_COLOR.fla

kglad
Community Expert
Community Expert
February 13, 2016

there was a typo in my previous message.  use the current code in message 1.