Flash bugs, continued
ECHT WAA!
The length property does not apply to associative arrays, also known as “Named arrays.” An associative array is really just a generic object with properties. To get the number of items in an associative array, you can use a for…in loop and a counter:
Dus met andere woorden, de .length property bestaat ni bij named artrays (of associative arrays zoals ze zeggen).
Dus:
var test:Array = new Array();
test[0] = "foo";
test[1] = "bar";
trace(test.length);
zal als output 2 geven. MAAR!
var test:Array = new Array();
test['a'] = "foo";
test['b'] = "bar";
trace(test.length);
geeft als output 0. Wtf? Nen uitleg da ik hier vond:
Francis Cheng said on May 2, 2005 at 3:10 PM :
The length property does not apply to associative arrays, also known as “Named arrays.” An associative array is really just a generic object with properties. To get the number of items in an associative array, you can use a for…in loop and a counter:
Hoe komen ze erop. Weer een uur kwijt…
4 commentaren October 21st, 2005