[Laszlo-dev] Bracket syntax notation in AS3
André Bargull
andre.bargull at udo.edu
Sat Nov 1 07:41:55 PDT 2008
Can anyone explain to me, why `++(o['count'])` fails to compile for AS3?
Thanks!
> <canvas>
> <handler name="oninit" >
> var o = {count:0};
> if (++(o.count) == 1) Debug.write("it's one");
> //Error: Implicit coercion of a value of type String to an unrelated
> type Number, in line: if (++$2["count"] == 2) {
> //Error: Comparison between a value with static type String and a
> possibly unrelated type int, in line: if (++$2["count"] == 2) {
> // if (++(o['count']) == 2) Debug.write("it's two");
> //Error: Operand of increment must be a reference, in line: if
> (++(o["count"] as int) == 3) {
> // if (++(o['count'] cast int) == 3) Debug.write("it's three");
> //Error: Operand of increment must be a reference, in line: if
> (++int(o["count"]) == 4) {
> // if (++(int(o['count'])) == 4) Debug.write("it's four");
> </handler>
> </canvas>
More information about the Laszlo-dev
mailing list