4 Replies Latest reply on May 21, 2007 5:44 PM by HyderAlamgir

    assigning Flex variables

    ljonny18 Level 1
      HI I was wondering if someone could possibly help me ???

      basically (as an example)....... I have an array that I want to "flatten" and put into an object..... e.g. :

      var count:int = -1;
      var flatObj:Object = new Object;
      for(var x:int=0; x<myArray.length; x++)
      {
      count++;
      flatObj.valueA_1 = myArray[count].valueA;
      flatObj.valueB_2 = myArray[count].valueB;
      flatObj.valueC_3 = myArray[count].valueC;
      flatObj.valueD_4 = myArray[count].valueD;
      }

      but within the loop, I want to set the number valuse (valueA_1) = to the count value
      e.g.
      valueA_(count) etc.....

      flatObj.valueA_(count) = myArray[count].valueA;
      flatObj.valueB_(count) = myArray[count].valueB;
      flatObj.valueC_(count) = myArray[count].valueC;
      flatObj.valueD_(count) = myArray[count].valueD;

      which sohud be the same ......

      I just need to know, how I can add the count value to the string / test valueX_......
      I assune ut is something like: valueA_{count} or valueA_#count# etc..... but I cant work it out :(

      thanks again,
      Jon.