You're not really using Array as an Array... you're using it as an
Object to store name/value pairs. The 'length' property of an Array only
works when you store integrally-indexed elements:
 
var myArray:Array = [];
myArray[0] = a;
myArray[1] = b;
myArray[2] = c;
// myArray.length is now 3
 
When you use Object or Array to store name/value pairs, there is no way
to count how entries you've stored, other than looping over all of them
with a for-in or for-in-each loop. (Of course, you could keep track of
the count yourself in another variable.)
 
Gordon Smith
Adobe Flex SDK Team

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of annouss79
Sent: Saturday, February 23, 2008 2:06 PM
To: [email protected]
Subject: [flexcoders] array.length



i need help with array in flex , anyone can help me ?

var myMap:Array = new Array();
myMap["A"] = a;
myMap["B"] = b;
myMap["C"] = c;
Alert.show(myMap.length.toString(),"length info")

i got 0 as length , what's wrong ?



 

Reply via email to