Usually you will want to set the combobox's selectedIndex or selectedItem, not 
its text

Alex Harui
Flex SDK Developer
Adobe Systems Inc.<http://www.adobe.com/>
Blog: http://blogs.adobe.com/aharui

From: [email protected] [mailto:[email protected]] On Behalf 
Of Dan Pride
Sent: Tuesday, November 10, 2009 8:11 AM
To: [email protected]
Subject: [flexcoders] ComboBox intialization problem



I am switching viewstacks from a doubleclick on a data grid to a data entry 
screen for the record. Classic database stuff.
Everything works great except for the first time on the ComboBox's, then after 
one time everything works. (In one of my old languages it would be an 
initialization problem),

All other fields write properly. I am not using Carngorm on this app yet altho 
am rapidly headed in that direction, but need to solve this one as is if 
possible.

On double click I load the value into a public bindable variable and then 
switch viewstack and rely on the binding to fill the value in the Combobox. 
(Using it as a popup to select a single value).

[Bindable]
public var locaQuality:String;

[Bindable]
public var locaQualityArr:ArrayCollection = new ArrayCollection(
[ {label:"", data:1}, {label:"Clean", data:2}}]);

<mx:ComboBox id="LocaQualityCol" dataProvider="{locaQualityArr}"   
text="{locaQuality}" close="closeLocaQuality(event);" labelField="label" 
x="246"  y="128" width="125" themeColor="#009DFF"  height="22" 
textAlign="center"/>

private function editLoca(event:Event):void {
    locaQuality = locaGrid.selectedItem.locaQualityCol;
        ....
        home.selectedIndex = 3; }

private function closeLocaQuality(event:Event):void{locaQuality = 
LocaQualityCol.selectedItem.label;}


Thanks
this one has me stumped !
Dan Pride


Reply via email to