The valueCommit event does what I expected. The reference for the change event is a bit misleading, because the change event seems to be dispatched ONLY when the combobox changes as a result of user interaction.
Thanks, Kilian --- In flexcoders@yahoogroups.com, "Tracy Spratt" <[EMAIL PROTECTED]> wrote: > > You probably want the valueCommit event. > > > > Be aware that this event fires quite often, and you will need to check > for null values and watch out for endless loops. > > > > Tracy > > > > ________________________________ > > From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On > Behalf Of Alex Harui > Sent: Tuesday, May 27, 2008 11:16 AM > To: flexcoders@yahoogroups.com > Subject: RE: [flexcoders] ComboBox change event > > > > Because that isn't a "result of user interaction" (with the ComboBox > directly). > > > > ________________________________ > > From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On > Behalf Of kilian.schumm > Sent: Tuesday, May 27, 2008 4:42 AM > To: flexcoders@yahoogroups.com > Subject: [flexcoders] ComboBox change event > > > > Hi, > > this little example tries to update the selectedItem property of a > ComboBox from somewhere outside the ComboBox. > > The Flex 3 reference says about the ComboBox change event: "Dispatched > when the ComboBox contents changes as a result of user interaction, > when the selectedIndex or selectedItem property changes, and, if the > ComboBox control is editable, each time a keystroke is entered in the > box." > > When I run this application and click on the MasterCard Button, the > selectedItem property changes, but the change event is not dispatched > - does somebody out there know why ?? > > Kilian > > here is the code (taken from adobe`s reference and made some changes): > > <?xml version="1.0"?> > <!-- Simple example to demonstrate the ComboBox control. --> > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml > <http://www.adobe.com/2006/mxml> "> > > <mx:Script> > <![CDATA[ > import mx.collections.ArrayCollection; > > [Bindable] > public var cards:ArrayCollection = new ArrayCollection( > [ {label:"Visa", data:1}, > {label:"MasterCard", data:2}, > {label:"American Express", data:3} ]); > > private function changeHandler(event:Event):void { > myLabel.text = "You selected: " + > ComboBox(event.target).selectedItem.label; > myData.text = "Data: " + > ComboBox(event.target).selectedItem.data; > } > > private function buttonHandler(event:Event):void { > box.selectedItem = cards.getItemAt(1); > } > ]]> > </mx:Script> > > <mx:Panel title="ComboBox Control Example" > height="75%" width="75%" layout="horizontal" > paddingTop="10" paddingBottom="10" paddingLeft="10" > paddingRight="10"> > > <mx:ComboBox id="box" dataProvider="{cards}" width="150" > change="changeHandler(event);"/> > > <mx:VBox width="250"> > <mx:Text width="200" color="blue" text="Select a type of > credit card."/> > <mx:Label id="myLabel" text="You selected:"/> > <mx:Label id="myData" text="Data:"/> > </mx:VBox> > > <mx:Button label="MasterCard" click="buttonHandler(event);"> > </mx:Button> > > </mx:Panel> > </mx:Application> >