change state when hover on another spark element
How to set a hover state (upSkin) when hover on another element? This example is not working on spark: https://stackoverflow.com/questions/3364244?tab=oldest#tab-top
Would like to do something like this:
<s:Button id="but1"/>
<s:Button label="chan开发者_开发问答ge" mouseOver="button2_mouseOverHandler(event)"/>
protected function button2_mouseOverHandler(event:MouseEvent):void{
//make but1 look like I'm hovering it
}
When mouse is over element A, you want element B to change style? Create event listeners for A (MouseEvent.ROLL_OVER, MouseEvent.ROLL_OUT). Or what?
Update: get skin object and set one of the four states: up, over, down, disabled (found in skin.states array):
var skin:ButtonSkin = ButtonSkin(button1.skin);
skin.setCurrentState("over");
精彩评论