Search code examples
actionscript-3vectorflash-cs4flash-cs5

How to Increase Vector length to 200 after new Vector.<String>(100);


HI All,

//Created Vector with the initial length of 100.

var v:Vector. = new Vector.(100);

v[90] = "Ninety"

v[190] ="oneninety" //RangeError: Error #1125: The index 110 is out of range 100.

//How to change the length from 100 to 200 to store a value at index 190 ?


Solution

  • To change the size of a Vector you just set the length property. eg:

    v.length = 200;
    v[190] = "something"; // works now