Yes, that's what I fugured.
  Here is my code. 
  I have a combobox as a form item.:
  <mx:FormItem label="Other RailRoad Involved" width="302">
  <customComponents:comboItemRenderer 
  selectedIndex="{modelGeneral.otherrailroadinvolved}" 
  id="otherrailroadinvolved" width="95">
  </customComponents:comboItemRenderer>
  </mx:FormItem>
  dataModel tag:
  <moduleCode:accidentsGeneralModel id="modelGeneral"/>
   
  Data Model:
  public class accidentsGeneralModel
  {
  private var _otherrailroadinvolved:int = 0;
  [Bindable]
  public var modelValid:Boolean = false;
  
   
  [Bindable]
  public function get otherrailroadinvolved():int
  {
  return _otherrailroadinvolved;
  }
  public function set otherrailroadinvolved(otherrailroadinvolved:int):void
  {
  _otherrailroadinvolved = otherrailroadinvolved;
  }
  Combo's data:
  combo.dataProvider = someXML;
   
  Form's data:
  //reference to main application
  mainApp = mx.core.Application.application;
  // reference to Accidents module
  accidentsModule = mainApp.moduleLoader.child;
  accidentsModule.modelGeneral.otherrailroadinvolved = 
resultXML.general.otherrailroadinvolved;
   
  Here is what happens:
  If I am setting up form's data after combo's dropdown has been set then the 
combo will show the correct item: item that is driven by the form's data. But 
if I do it other way around then the combo does not show the correct one but 
always has its selectedIndex = 0.
  I am trying to override dataProvider property but dont know what I can match 
combo's dropdown data to to set its selectedIndex manually.
   
  Thanks
Alex Harui <[EMAIL PROTECTED]> wrote:
              Unless comboItemRenderer is in a List or DataGrid or other 
ListBase-derived class, the listData setter function will not be called.
  
  Assigning the combo’s dataprovider just tells its dropdown List what to 
display.
  
      
---------------------------------
  
  From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of mark 
goldin
Sent: Thursday, January 03, 2008 6:17 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Setter question

  
          Combo:

  package
  CustomComponents 
  {
  import mx.controls.*; 
  import mx.controls.listClasses.*; 
  import mx.collections.*; 
  import flash.events.Event; 
  import mx.events.*; 
  public class comboIte! mRenderer extends ComboBox implements 
IDropInListItemRenderer 
  {
  public function comboItemRenderer() 
  { 
  super(); 
  }
  override public function set listData(value:BaseListData):void 
  {
  super.listData = value; 
    ......

    

    Assigning data:

    combo.dataProvider = XMLData;

    Should I be getting into listData function after that command?

  
Gordon Smith <[EMAIL PROTECTED]> wrote: 
      What do you mean by defining a "set function" for the ComboBox? Can you 
show some code?
    

    Gordon Smith

    Adobe Flex SDK Team

  
    
---------------------------------
  
  From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of 
markgoldin_2000
Sent: Thursday, January 03, 2008 5:44 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Setter question
      I have a combobox in a form. I have also defined a set function for 
that combo. I am assigning data to the control using:
combo.dataProvider = someXML. The data is shown with no problem, but 
set function is not called. Am I doing something wrong?

Thanks




  

  



  

                         

Reply via email to