I temporarily have found the answer of using the valueCommit event instead of change event as the trigger to update the second comboBox as it fires on both programmatic and user driven events.
--- In [email protected], "Jamie O" <[EMAIL PROTECTED]> wrote: > > I remember googling somewhere that when you programatically change > combo box data it doesn't trigger the change event. You had to force > an event to fire or on that event call your function or something? > > I've built a component that calls an XML source. One combobox > (cmbStreet) is a normal dataprovider list, the second (cmbNumber) uses > the selection from cmbStreet to find the specific node in the XML and > populate based on the relevant attributes. > > That part of the code is working, except that I can't seem to clean > all the entries from the array or dropdown list and the function won't > execute on first load. I've tried it in creationComplete but I don't > think the data is loaded to find results at that point. > > <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="375" > height="40" borderStyle="solid" borderThickness="0" > creationComplete="UpdateList()"> > <mx:Script> > <![CDATA[ > import mx.controls.List; > [Bindable] > public var xmldpPC:XML; > > [Bindable] > private var NumberList:Array = new Array(); > > private function UpdateList():void { > var xmldpStreet:XML; > xmldpStreet = new XML(xmldpPC.Municipality.Streets.Street.(@Name == > cmbStreet.selectedLabel)); > > //I think more better stuff has to happen here. > NumberList.length = 0; > cmbNumber.selectedIndex = 0; > > for each (var StreetValue:XML in xmldpStreet.Number) { > NumberList.push([EMAIL PROTECTED]()); > } > } > > ]]> > </mx:Script> > > <mx:ComboBox x="3" y="12" id="cmbNumber" width="75" > dataProvider="{NumberList}"></mx:ComboBox> > > <mx:ComboBox x="85" y="12" id="cmbStreet" width="200" > dataProvider="[EMAIL PROTECTED]" > change="UpdateList()"/> > > </mx:Canvas> > -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/flexcoders/join (Yahoo! ID required) <*> To change settings via email: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

