2 Replies Latest reply on Sep 14, 2006 10:07 PM by HaifengPang

    A question about DataService and data binding

      With the help of Adobe Flex DataService sample, I set up a project that can get data from my Oracle db successfully, here are some codes:
      public var ds:DataService;
      public var road:ArrayCollection;
      public function initApp():void{
      road = new ArrayCollection();
      ds = new DataService("speed");
      <mx:DataGrid id="dg" dataProvider="{road}" editable="true" x="40" y="647">
      <mx:DataGridColumn dataField="id" headerText="ID" editable="false"/>
      <mx:DataGridColumn dataField="speed" headerText="Speed"/>
      <mx:DataGridColumn dataField="sample" headerText="Sample Size"/>
      <mx:DataGridColumn dataField="x" headerText="X axis"/>
      <mx:DataGridColumn dataField="y" headerText="Y axis"/>
      I noticed that after the swf page has been requested, an empty DataGrid control was drawn first, then some data fill into the grids about 1~2 secs later. Here is the promble:I want to draw a line using the data from db, but either on Application's CreateComplete event or applicationComplete event, I can't use the 'road' because it is EMPTY! It means that after the application complete( that's to say all components has been created), data from db hasn't arrived, and it will arrive about 1~2 secs later. Who can tell me how can I control this procedure, I mean how can I get data just after the method fill() is called?
      Thanks a lot!