问题
I need to trigger the hover state of a Flex button programatically, so that it looks like the user is hovering over it. There is a flex page about "Manually dispatching events":
http://livedocs.adobe.com/flex/3/html/help.html?content=events_07.html
Which would work, but what I'd really like to do is change the style of the button without having to throw an event. How can I do this?
Thanks!
回答1:
Is there any reason this wouldn't work?
button.setStyle('skin', button.getStyle('upSkin'));
回答2:
In Flex 4x it is best to change the skin its self, this will do the trick.
button.setStyle('skinClass', SkinClass);
来源:https://stackoverflow.com/questions/3364244/how-do-i-manually-trigger-a-buttons-hover-state-in-flex