Populating a Vector in the constructor
There is a small difference between populating a Vector while instancing it and an Array.
While an Array is instanced this way:
var names:Array = ["Bob", "Larry", "Sarah"];
a Vector can be instanced like this:
// In the constructor var names:Vector.<String> = new <String>["Bob", "Larry", "Sarah"]; // Converting from a regular Array using the Vector global (about three times slower) var names:Vector.<String> = Vector.<String>(["Bob", "Larry", "Sarah"]);
Tags: Array, AS3, constructor, populate vector, Vector
July 11th, 2012 at 19:16
Thanks! Was useful for me today