Flex Gumbo ItemRenderer — disable ‘hovered’ state
Whilst creating a custom ItemRenderer in Flex Gumbo, I came across an interesting problem. When adding new custom states to your renderer, it’s important to not neglect to add the default states as well, for fear of throwing RTE’s.
All I wanted to do was for my CustomItemRenderer to happily exist in ‘customStateOne’ and then to switch to ‘customStateTwo’ upon a certain event. Seemed like an easy setup, until I noticed that upon MOUSE_OVER of the ItemRenderer, the state would switch to ‘hovered’ and on MOUSE_OUT, switch back to ‘normal’. Not ideal in the slightest!
After a bit of googling, I came across this post on the Adobe forums dealing with exactly the same problem.
It seemed to me like complete overkill to try overriding the getCurrentRendererState() method and building a custom renderer from a UIComponent, as the post suggested, and fortunately — as is often the case — I found the solution I was after right under my nose.
Simply set mouseEnabled=false in your custom itemrenderer’s constructor!
< ?xml version="1.0" encoding="utf-8"?>
Thus preventing the MOUSE_OVER ( ‘hovered’ ) state from being triggered and consecutively not switching to the ‘normal’ state on MOUSE_OUT.