- A complex Flex component you want to act as a button
- Too complex to implement as a button with skins
- MouseOver/Out behavior involves redrawing/resizing parts of the component
Make the top-level subcomponent (in z-order) of the component a button component with alpha of 0. Make it cover the precise bounding box you want to be sensitive to mouse events. (It may be possible to mask the button to achieve non-rectangular mouse regions, but I haven't tried this.) Put the mouse event listeners on the button only, not the whole component. Then making the component mouseEnabled="true", mouseChildren="true", and making other subcomponents mouseEnabled="false" will cause the button subcomponent to catch all the mouseEvents, without the underlying redraws affecting it.
0 comments:
Post a Comment