5 Replies Latest reply on Jan 19, 2009 10:46 PM by LinkMc

    Need help with syntax for getting data from an ArrayCollection

      Hi, I have a function that simply needs to access a piece of information from an ArrayCollection called "myData".
      "myData" consists of a single row of data which was just filtered. Here is my current code:

      private function checkResults():void
      if (myData.length == 1)
      Alert.show("Welcome " + myData.firstname) ;
      Alert.show("Failed login");

      I know how to access this data for a Label by this:
      <mx:Label id="testLabel" text = "{myData.username}"/>

      The myData array contains the fields "username","password","firstname","lastname", etc. and I just want the alert in my function to grab the firstname and display it. But as my coding currently exists I keep getting a possible undefined property error with it.

      Since "myData" is used inside of a function I'm not sure what syntax to use to retrieve a value from a field in this array.