I am converting some AS3 classes, and I stumbled on a problem: how do I assign a predefined list of values to a Vector (openfl.Vector)?
In AS3 it worked like this
var cylinder:Vector.<Number> = Vector.<Number>([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);
but in Haxe I can’t do like this
var cylinder:Vector<Float> = [1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];
as it recognizes the […] as an Array of Ints.
var cylinder:Vector<Float> = cast([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1], Vector<Float>)
a acceptable/feasable/correct solution? It doesn’t look cool.
I don’t want to do a loop to insert each element by .set method indeed.