Every interactive Flex component has a "click" event that is triggered when the component is selected by the mouse. It quickly becomes an ingrained habit to add a click event to components you want users to select. This habit lead me into trouble with a List component.
The "click" event for a List occurs whenever any part of the List is selected. For example, selecting the up button of the scroll bar will cause the List component to emit a click event. This isn't the event you want to respond to if you are trying to detect when an item in the list is clicked. The actual event I needed was the "itemClick" event. It seems like a small thing but it made a big difference to how my small application worked.
Friday, October 19, 2007
Subscribe to:
Post Comments (Atom)
4 comments:
Thanks! I got so lost trying to figure out how to use click() with my list.
Hi Kajun,
glad it came in useful. The post has been a useful reminder for me on a few occassions.
Problem with this - what if the user hits the up or down arrows on their keyboard to change the selected item? The itemClick event doesn't fire in this case at all.
Oops, forgot to recommend an alternate solution - use the 'change' event. This fires on both keyboard changes and mouse changes. In fact the 'change' event is probably what you want in most cases, not just with List.
Post a Comment