as3 Vector with init values

2019-04-06 03:49发布

问题:

I want to instantiate a Vector.<Number> with two values of 1.0

You might think I would do Vector.<Number>(1.0, 1.0); but that only traces 0

Is what I'm trying to do possible? If so, how? Or am I stapled to the routine of using .push ?

回答1:

This one is even shorter:

var vec:Vector.<Number> = new <Number>[1.0, 1.0];