ufk
ufk

Reputation: 32104

flash cs4: change the look of a button after it's been pressed

I'm trying to create a top panel menu that contains 5 buttons.

I configured Up and Over state for each button.

how can I configure that one the button is clicked, the look of the button will change to the look i configured in Over state.

Each state contains a different image.

Is there a way to change the look of the button to the look it configured in it's different states using Action Script?

Using Flash CS4 Action Script 3.

thank you.

Upvotes: 1

Views: 2050

Answers (3)

ufk
ufk

Reputation: 32104

I resolved the issue by creating a MovieClip with two frames, one for with each button state, and i just used gotoAndStop when needed to move to the required frame.

In each state I didn't need only to change color, but to the change the all visual presentation of the button.

it seems that i could not find any way to do that with a regular Button Object.

thanks.

Upvotes: 0

ground5hark
ground5hark

Reputation: 4514

Something like this should work:

button.addEventListener(MouseEvent.CLICK, onButtonClick);
function onButtonClick(e:MouseEvent):void {
    // Given you have a changeColor method defined in your button class
    e.target.changeColor('#ff9900');
}

Upvotes: 1

Jason
Jason

Reputation: 2503

In the onClick event for the button you can change Up skin to be the same as the Over skin.

Upvotes: 0

Related Questions