[haXe] flash.util.Dictionary object requires Int
Nicolas Cannasse
ncannasse at motion-twin.com
Sun Nov 11 15:31:54 CET 2007
Trevor Burton a écrit :
> hi,
>
> i'm having issues with the Flash Dictionary class in Haxe.
>
> if i do this:
>
> var dict:Dictionary = new Dictionary();
> var test:String = "key";
> dict[ test ] = value;
>
> i get this error from the compiler:
>
> "String should be Int"
>
> It seems to want the Dictionary object's indexes to be int values (a
> la Array) rather than being able to put anything in there (a la
> Dynamic).... can anyone point out what i'm missing here?
ArrayAccess<Dynamic> means that it can be accessed as an array and
contains Dynamic values. In haXe, it's not allowed to access using other
thing than an int, but the following should work :
dict[cast test] = value;
Best,
Nicolas
More information about the Haxe
mailing list