I'm not sure I explained myself well enough. I extended the basic CheckBox component. The only visual elements that I added was the Sprite which draws the middle state indicator above the checkbox icon. This Sprite is added at creationComplete (to make sure it's added after all the icons, etc).
I do not dynamically draw anything. I'm toggling visibility of my Sprite for the mid-state. When the CheckBox is first drawn it looks correct. A mouseover brings the (default) icon to the top and a mouseout seems to do the same. I fixed the mouseover behavior by adding an event listener to move my sprite back to the top, but this only works on mouseover -- not mouseout. I am very puzzled as to why. Possibly there's another event which fires after mouseout which I'm not aware of? I like to keep default behavior as much as possible, and I don't want to have to draw my own components unless there's no choice... Harbs On May 27, 2010, at 12:45 PM, Paul Andrews wrote: > On 27/05/2010 07:34, Harbs wrote: > >> I'm trying to implement a tri-state checkbox. I found a previous >> implementation which was way to complicated for my taste. I have the >> implementation mostly done, but there's one issue which I'm having a hard >> time with: >> >> I created a Sprite which draws the mid-state indicator over the checkbox >> icon. Moving the mouse over the checkbox or away from the checkbox seem to >> move the checkbox icon on top of my Sprite. I was able to handle the Mouse >> Overs by adding an additional MOUSE_OVER event which moves the Sprite back >> up to the top of the stack. For some reason this only works for MOUSE_OVER. >> I added a MOUSE_OUT event listener as well, which did not do anything. The >> icon still appears above the Sprite when the mouse moves away from the >> checkbox. >> >> Any ideas why? > > I don't see why you are having the problem, but suspect it may be due to > dynamically drawing components in response to mouseover/out, etc. > > My approach would be to create a component that has as part of the > initialisation, all of the components for the visual state created. Then I > would show/hide these according to the three states of the component - either > by toggling visibility/changing alpha/changing state. > > For components like this, I generally toggle the visibility according to > state (though I rarely use Flex states) except when I need a more > sophisticated transition between component states. > > Paul > > > >> >> Thanks, >> Harbs > > >

