Reduce the test case down to about 20 lines and post it and tell us where you set a breakpoint. Remember that the dataProvider will be null until the CallResponder returns with data.
On 10/4/11 8:22 PM, "Rodolfo Bibolotti Ramírez" <[email protected]> wrote: Hi, I don’t know what id is because the dataProvider not has data and the program not enter to the loop. I’d like to know why the dataProvider is empty when in the browser the combo has data. Thanks. Rodolfo. De: [email protected] [mailto:[email protected]] En nombre de Angelo Anolin Enviado el: lunes, 03 de octubre de 2011 7:30 a.m. Para: [email protected] Asunto: Re: [flexcoders] combobox problem In your function: public function BuscarParametroId(parametroId:int = 0):void How do you know that the keyword this refers to the combobox? Could you try exchanging the word this to an ID of the combo box and see what happens? ________________________________ From: Rodolfo Bibolotti Ramírez <[email protected]> To: [email protected] Sent: Saturday, October 1, 2011 12:13:53 PM Subject: [flexcoders] combobox problem Hi, I’m just learning Flash Builder and I have a problem with the combobox. I have a datagrid and every time I change a cell it load a form with the details. It Works fine. Now, in the form I have defined a combobox that it’s loaded with data using the flex data wizard. It is loaded OK. The labels are OK. The data contains the label and the code of the label. My problema is that I want to pass to the combo the code of any element and that the combo should locate that value and show the respective label. I implemented a function that should look up on the dataProvider but when I debug the program the dataProvider is empty. This is the event that calls the forma and call the combo’s function: protected function grdDatos_selectionChangeHandler(event:GridSelectionEvent):void { currentState = "sttMantenimiento"; libro_contable1.BuscarParametroId(tipoVoucher.libro_contable.id ); } In the form: <s:FormItem label="Origen"> <partes:cbbParametros dominio="32" id="libro_contable1" /> </s:FormItem> This is the combo definition: <?xml version="1.0" encoding="utf-8"?> <s:ComboBox xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:parametrosservice="services.parametrosservice.*" creationComplete="comboBox_creationCompleteHandler(event)" labelField="descripcion" xmlns:valueObjects="valueObjects.*"> <fx:Script> <![CDATA[ import mx.collections.ArrayCollection; import mx.events.FlexEvent; [Bindable] public var dominio:int; protected function comboBox_creationCompleteHandler(event:FlexEvent):void { getParametrosResult.token = parametrosService.getParametros(dominio); } // http://www.forta.com/blog/index.cfm/2006/11/22/Flex-ComboBox-With-selectedValue-Support public function BuscarParametroId(parametroId:int = 0):void { for (var i:int=0; i < this.dataProvider.length - 1; i++) { if ( this.dataProvider[i].id == parametroId ) { this.selectedIndex = i; // this.dispatchEvent( new ListEvent( ListEvent.CHANGE ) ) // since we are changing it we need to dispatch it break; } } } ]]> </fx:Script> <fx:Declarations> <s:CallResponder id="getParametrosResult"/> <parametrosservice:ParametrosService id="parametrosService" showBusyCursor="true"/> <valueObjects:Parametro id="parametroVO"/> </fx:Declarations> <s:AsyncListView list="{getParametrosResult.lastResult}"/> </s:ComboBox> FlashBuilder for PHP, versión 4.5 The load of the data in the combo was defined with the wizard. The VO: class Parametro { public $id; public $dominio; public $parametro; public $descripcion; public $abreviacion; public $mascara_valor; public $orden; public $estado; public $valor_equivalente; public $valor_numerico; public $usuario_creacion; public $fecha_creacion; public $usuario_modificacion; public $fecha_modificacion; The label is “descripción”. I’m passing the id to the combo to locate it in the respective label. Thanks. Rodolfo. -- Alex Harui Flex SDK Team Adobe System, Inc. http://blogs.adobe.com/aharui

