开发者

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

开发者 https://www.devze.com 2022-12-23 23:51 出处:网络
开发者_如何学GoI\'m trying to create a top panel menu that contains 5 buttons. I configured Up and Over state for each button.

开发者_如何学GoI'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.


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');
}


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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号