Add an easy way to initialize.

Jeez, this whole thing could *almost* go away if we moved to flash 10
and used Vector, but of course, there's no way to get the type of
Vector. Maybe there is, with describeType(). Can't experiment now.
I'd fall out of my chair if there were.
We need to know in case sending an empty array to the server,
it's still gotta be the right type (with non-empty we could
try examining the first element).


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5742 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2009-04-23 00:30:44 +00:00
parent bfcb45434e
commit 5df1335471
+6 -2
View File
@@ -55,9 +55,13 @@ public dynamic class TypedArray extends Array
/**
* A factory method to create a TypedArray for holding objects of the specified type.
*/
public static function create (of :Class) :TypedArray
public static function create (of :Class, initialValues :Array = null) :TypedArray
{
return new TypedArray(getJavaType(of));
var ta :TypedArray = new TypedArray(getJavaType(of));
if (initialValues != null) {
ta.addAll(initialValues);
}
return ta;
}
/**