I’m trying to pass colors into a vector, like this:
public function Button(_graphic:Image, _colors:Vector.<uint> = Vector.<uint>([0xFF0000, 0x770000, 0xFF5555, 0x333333]), _x:Number = 0, _y:Number = 0, _f:Function = null)
{
this._buttonImage = _graphic;
this.colors = _colors;
super(_x, _y);
setHitbox(_graphic.width, _graphic.height);
this.callback = _f;
graphic = this.buttonImage;
}
But, I’m getting the build error:
C:\Users\Daivd\Desktop\FBLA\FBLAproject\src\Button.as(19): col: 67 Error: Parameter initializer unknown or is not a compile-time constant.
public function Button(_graphic:Image, _colors:Vector.<uint> = Vector.<uint>([0xFF0000, 0x770000, 0xFF5555, 0x333333]), _x:Number = 0, _y:Number = 0, _f:Function = null)
^(pointing to = Vector.<uint> ([]) bit.)
Build halted with errors (fcsh).
(fcsh)
Done(1)
I’ve never worked with Vectors before, but this seems to be what everyone does and it works for them, but for some reason it isn’t working for me. Anybody see what I’m doing wrong?