Posted By

chrisaiv on 11/12/08


Tagged

as3 cs4 Vector


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

THEPWN3R
dx0ne
tspitzr


AS3: Optimized Arrays (AKA Vector)


 / Published in: ActionScript 3
 

This feature which is available in Flash CS4 is a much more efficient Array. Unlike Array, you cannot place data in any given index. Each index must have a value. For example, you can't have data in Array[0] and Array[5] but nothing in between. The second parameter is a Boolean and it decides whether the Vector array can have more indexes added later.

  1. //In this case, the Vector will only hold a DataType of <uint>
  2. var numbers:Vector.<uint> = new Vector.<uint>(3, false);
  3. numbers[0] = 1;
  4. numbers[2] = 2;
  5. numbers[3] = 3;
  6.  
  7. trace( numbers )

Report this snippet  

You need to login to post a comment.