[mtasc] array index, byte and compiler problem
Lorenzo Sicilia
arnor at kemen.it
Sat Nov 19 16:30:28 CET 2005
Hi to all,
I have an array where I would like to use a byte like a key.
My goal it's a fast function with I can check if a Mask of Bit it's true or
false than I trigger an event
...
public static var MYINDEX = 0x04;
this.controList = new Array();
this.controList[MYINDEX] = Delegate.create(this,this.myMethod);
...
public function checkMask() {
for (var mask:Number in this.controList){
this.controList[mask]((value & mask) != 0 );
}
}
public function myMethod(status:Boolean):Void{
if (status){
trace (ok")
}else{
trace ("ko")
}
}
in my controlList the key it's the constant MYINDEX and the object it's a
reference to myMethod.
when I check if the mask it's true myMethod get a true or false.
With MM it works nice. In mtasc I get this compiler error:
Input.as:35: characters 27-39 : type error String should be Number
the snip:
35->for (var mask:Number in this.controList){
36-> this.controList[mask]((value & mask) != 0 );
37->}
in java when I use an HashMap I can use a byte key like hash.put(byte[] key)
in flash I can put an Objet in the key. Than I think that the best return type
from a for in it's Object and not String.
It's just my opinion :)
Regards Lorenzo
More information about the mtasc
mailing list