1 Reply Latest reply on Oct 26, 2007 7:52 AM by kglad

    Array Splice problems...

    trezbo
      Hi i am loading in xml into Flash
      <question ID="n3.1a" level="3" />
      <question ID="n3.2b" level="3" /> ... etc all the way to n3.12b

      So what i am trying to do is to Splice the array into 2 parts all the questions ID's that are A and all that are B for for example an array with:
      level3a_Array = [n3.1a,n3.2a,n3.3a,n3.4a]
      level3b_Array = [n3.1b,n3.2b,n3.3b,n3.4b]

      but i am having problems with the code below trying to splice them, so any help would be great!!!

      var diagnosticXml:XML = new XML();
      diagnosticXml.ignoreWhite = true;
      diagnosticXml.load("databank/databank.xml");
      diagnosticXml.onLoad = function(success:Boolean){
      if(success){
      aLevel = diagnosticXml.firstChild.childNodes;
      lev3Array = aLevel[0].childNodes;

      for(var a=12; a>0; a--){
      var level_3:Number = _root.aLevel[0].childNodes.length;
      _root.aLevel[0].childNodes.splice(0, 1);
      lev3B_Array = _root.aLevel[0].childNodes.splice(0, 1);
      }
      trace("lev3Array: "+ lev3Array);
      }
      }