[Laszlo-dev] Bracket syntax notation in AS3

P T Withington ptw at pobox.com
Mon Nov 3 07:53:31 PST 2008


I would say it is a Flex bug.  I bet their expander for ++ is just  
screwing up somehow, probably incorrectly trying to increment 'count'  
or something.  I would file a bug with Adobe.

On 2008-11-01, at 10:41EDT, André Bargull wrote:

> 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