I'm not entirely sure, but I would have expected your code to throw an error.
The function references an MXML DataGrid ( dg ) inside bpmnFigureData before bpmnFigureData is added as a child. That means that createChildren hasn't been run yet and I would expect DG to be null. --- In flexcoders@yahoogroups.com, Nini7016 Nini7016 <nahloulaha...@...> wrote: > > > Hello :) > > I created a dataGrid in a file MXML like this : * > > <mx:Panel title=" Handing Data" height="100%" width="100%" > paddingTop="10" paddingLeft="10" paddingRight="10"> > > <!--<mx:Label width="100%" color="blue" > text="Select a row in the DataGrid control."/>--> > > <mx:DataGrid id="dg" name="dataGrid" width="100%" editable="true" > resizableColumns="true" > > <mx:columns> > <mx:DataGridColumn dataField="variable" headerText="Variable" > /> > <mx:DataGridColumn dataField="type" headerText="Type" /> > <mx:DataGridColumn dataField="value" headerText="Value" /> > <mx:DataGridColumn dataField="operation" > headerText="Operation" /> > </mx:columns> > </mx:DataGrid> > > <mx:HBox width="100%" height="100%"> > <mx:Button name="validate" label="Validate" > click="{retreiveData(4,bpmnDataComponent)}" /> > <mx:Button name="cancel" label="Cancel" > click="{display(bpmnDataComponent)}"/> > <mx:Button name="add" label="Add Data" > click="{fillDataGridData2(start)}"/> > </mx:HBox> > > </mx:Panel> > > and i created a function called retreiveData like this in the same > Script : > > public function retreiveData(index : int , bpmnDataComponent : > BpmnDataComponent): void > { > var dp: ListCollectionView = dg.dataProvider as > ListCollectionView; > > if(dp==null){ > //dg.dataProvider = handData; > } > else { > Alert.show("longueur de DP"+dp.length.toString()); > var Objec : Object = dp.getItemAt(index); > bpmnDataComponent.Variable = Objec.variable; > bpmnDataComponent.Value = Objec.value; > bpmnDataComponent.Type = Objec.type; > > } > > > } > > And i called this function retreiveData when i clik in the button validate > in order to test if the function works well or not :) ....So it works well > > My aim is to call this function retreiveData from an actionScript but when > i do this : > > private function upateData(event:Event):void { > > var bpmnFigureData : BpmnFigureData = new BpmnFigureData(); // > BpmnFigureData : the name of the MXML FILE > bpmnFigureData.width=300; > bpmnFigureData.height=300; > bpmnFigureData.retreiveData(1,this); > this.addChild(bpmnFigureData); > > > } > > But unfortunatelley it didn't do what i asked ?? > > So my question how we can call function which be applicated in DATAGRID from > an ActionScript Class ..??? > > Any help please :(:( :( :( > > > Thank you very much > > > _________________________________________________________________ > Découvrez comment SURFER DISCRETEMENT sur un site de rencontres ! > http://clk.atdmt.com/FRM/go/206608211/direct/01/ >