1 Reply Latest reply on Oct 29, 2008 12:08 PM by rtalton

    ComboBox - Setting Selected Values from data

    is2 Level 1
      I am running into a problem in Flex 3 that seems to be different from Flex 2. Maybe someone can help.

      I have a function for setting a combobox selected item for a location for a value when the titlewindow completes loading. The value is a prior value from a prior save. In other words to set the combobox a value from a prior session.

      The locations xml file is loaded from a remote object oncreationcomplete of the titlewindow. The setselectedvalue function worked perfectly in Flex 2 but now only works in Flex 2 after the titlewindow is loaded. We tested this by running the setselectedvalue function from a button click after loading.

      The dataprovider length is showing 0 in our debugging. After titlewindow up on screen the length is showing correct ( 35 ) - in this case. Our viewxmlobject function is showing no xml. Shows xml correctly after up on screen.

      I have set the creationpolicy to "all". That did not help either.

      Any suggestions? Anyone. This is killing me. Spent two days now trying to get back to working state.

      private function SetSelectedValue_cbLocation(): void {
      var xLocID:String = eLocationID.text;
      //viewXmlObject( cbLocation.dataProvider )

      for (var i : int = 0; i < cbLocation.dataProvider.length ; i++) {
      //Alert.show( cbLocation.dataProvider .locid, 'Location DataProvider', Alert.OK);
      if ( xLocID == cbLocation.dataProvider
      .locid ){
      cbLocation.selectedIndex = i;


      The combobox has the dataprovider set at design time.

      <components:is2ComboBox id="cbLocation" x="585" y="4" width="196" dataProvider="{xmlLocations.Record}" labelField="locname" dataField="locid" change="changeLocation(event)" disabledColor="#004080" prompt="1. Please select location"></components:is2ComboBox>