1 Reply Latest reply on Aug 14, 2007 5:08 PM by chris.huston.t10

    get object from array

    MyronCope
      wondering if any of you could help me with this: i have an array of objects called arrMessages and I want to loop through the array and get each object so I can get the values stored in the object, how do i do this?

      what I have is below:

      <CODE>
      //declare the object
      var objMessageDG:MessageDatagridDisplayClass;

      for(i=0; i<intArrLength; i++) {
      //get object from array
      objMessageDG = = new MessageDatagridDisplayClass(arrMessages );
      }
      </CODE>
        • 1. Re: get object from array
          chris.huston.t10 Level 3
          Change to the below code:

          objMessageDG = new MessageDatagridDisplayClass(arrMessages );

          The == operator is not an assignment but a boolean check for equality. The
          gets item 'i' from the 0-indexed array.

          Another looping option would be to use for..in

          for (var i:Object in arrMessages) {
          objMessageDG = new MessageDatagridDisplayClass(i);
          }

          Vygo