0 Replies Latest reply on Jul 1, 2008 1:41 AM by SWiiT

    Why dose my xml load several times?

    SWiiT
      Hi i want to reload my XML in my DataGrid.
      But the problem is that is not deleting the first xml.

      The code looks like this.

      ----------------------------------
      private function fillGrid(event:Event):void {
      var loader1:URLLoader = URLLoader(event.target);
      myGridDataXML = XML(loader1.data);
      parentApplication.systemLogger("XML loaded");

      var i:int = 0;
      for each(var heading:XML in myGridDataXML.headings.heading) {
      var col:DataGridColumn;
      col = new DataGridColumn(heading.@name);
      col.width = Number(heading.@width);
      col.dataField = "col"+i;
      col.dataTipField = "col"+i;
      col.showDataTips = true;

      myColumns.push(col);

      if (heading.@list == "false")
      {
      col.visible = false;
      }

      if (heading.@key == "true")
      {
      keyIndex = i;
      }

      i++;
      }
      this.columns = myColumns;
      this.dataProvider = myGridDataXML.rows.row;
      }


      private function getData(onCompleteFunction:Function):void {
      var loader:URLLoader = new URLLoader();
      loader.addEventListener("complete", onCompleteFunction);

      var request:URLRequest = new URLRequest(getURL);
      try {
      loader.load(request);
      } catch (error:Error) {
      parentApplication.systemLogger("Unable to load requested document:" + error);
      }
      }

      private function updateGridData(event:Event):void
      {
      var loader2:URLLoader = URLLoader(event.target);
      myGridDataXML = XML(loader2.data);
      parentApplication.systemLogger("XML loaded");
      }
      -----------------------------------
      I am starting it with the getData(updateGridData)..

      Dose any one see what i am missing?