views:

759

answers:

2

I have a checkbox that is bound to a property:

<mx:CheckBox label="Show All" selected="{showAll}"/>

I want to trigger an event when the checkbox is toggled that will read the value of showAll after a change:

<mx:CheckBox label="Show All" selected="{showAll}" click="_list.refresh()" />

Where, in this case, _list is an ArrayCollection object whose filter function depends on the showAll field to choose values.

It turns out that this doesn't work, or at least gives a strong appearance of not working (what with the values in the list not changing and all). Is there a documented order of events for this, so that I can discover which events are dispatched in which order, and whether the binding value change will have fired the time the click event is dispatched? Alternately, can someone recommend a better way of doing this?

A: 

In a generic sence, the flex event order is:

  1. PREINITIALIZE
  2. INITIALIZE
  3. CREATIONCOMPLETE
  4. UPDATE COMPLETE

Refer to http://livedocs.adobe.com/flex/3/html/help.html?content=layoutperformance_03.html

online19
+2  A: 

I believe you have your data binding backwards...... changing the state of the check box by click or change event does not update the showAll variable. It works the other way around... If you change the showAll Boolean it will automatically update the state of the check box to selected or unselected.

Shua