insertAt + fixed Vector

Using insertAt on a fixed Vector increases the length of the Vector over the fix length, as long as the index to insert to, is lower then the fixed size.

var test:Vector<Float> = new Vector<Float>(3,true);
test.insertAt(0, 1); 
trace(test); //[1,0,0,0]
//shouldnt work, should it!?
//expected [1,0,0]

var test2:Vector<Float> = new Vector<Float>(3,true);
trace(test2); //[0,0,0]
test2.push(9); //error: cannot change length of vector

openfl.Vector:

	public function insertAt (index:Int, element:T):Void {
		if (!fixed || index < __array.length) {
			__array.insert (index, element);
		}
	}

Is there a better way to keep n-values, except inserting and then splicing it myself !?

What is the Flash behavior here?

We could certainly look at making fixes in openfl.Vector to support the proper behavior. Might also be good to look at other methods that might have a similar issue when fixed

If we can determine the right behavior, that’s half the battle :slight_smile: