2 Replies Latest reply on Jul 19, 2008 3:20 AM by jylaxx

    arrayCollection for dataProvider

      Hello every one,

      I'm a new french user here, so please be gentle :)

      My problem is that i'm trying to get a good arraycollection from my xml entirely in as3.
      I've already created my advancedDataGrid, put columns on it, ...

      I've also tried to put direct data on it and it works like that:

      var colDatas:ArrayCollection = new ArrayCollection(

      but my problem is that i don't understand how to get a correct arrayCollection dynamicaly from my xml.

      here is my XML:

      ?xml version="1.0" encoding="UTF-8" standalone="yes"?>
      <WS COL1="CL" COL2="********" COL3="GENERAL" COL4="BOULOC" COL5="31620" COL6="FRANCE" COL7="11" COL8="22" COL9="CONTACT" COL10="A" srowid="" srecid="279" ligne="1" />
      <WS COL1="AF" COL2="ABODINO33" COL3="ABODINO33" COL4="4 CHEMINS (LES)" COL5="12500" COL6="FRANCE" COL7="101" COL8="102" COL9="888" COL10="A" srowid="" srecid="345" ligne="2" />
      <WS COL1="CL" COL2="ALAIN66" COL3="ALAIN" COL4="PERPIGNAN" COL5="66000" COL6="FRANCE" COL7="" COL8="" COL9="" COL10="A" srowid="" srecid="428" ligne="3" />
      <WS COL1="CL" COL2="BONNY31" COL3="BONNY" COL4="TOULOUSE" COL5="31000" COL6="FRANCE" COL7="" COL8="" COL9="" COL10="A" srowid="" srecid="426" ligne="4" />

      and here is the code i wrote and which does'nt work:

      public function modifDataList(pEvt:Event):void{
      var dataXml:XML = new XML(pEvt.target.data);

      var resultArray:Array = new Array();
      var nbColumnsData:Number = dataXml.WS.length();

      for(var j:Number = 0;j<nbColumnsData;j++){
      var obj:Object = new Object();
      var attribNb:Number = dataXml.WS[j].attributes().length();

      for(var k:Number = 0;k<attribNb;k++){
      var colDatas:ArrayCollection = new ArrayCollection(resultArray);
      advDataGrid.dataProvider= colDatas;

      my goal is to make it dynamic because i don't receive the same number of attributes with all xmls.

      If you have any suggestion...

      thank you all.