Flex 3 Debugger anomaly
by Paul Taylor, Jan. 2, 2009, under [ actionscript ]

Working today, I discovered the debugger does something silly with for loops. If you have code formatted like so:

var i:int = 0;
var foo:int = 3;
for(; i < foo; i++){
        //Code here
}


If you set a breakpoint on line 3, where the for loop is defined, the Flex debugger will only stop after it has been through one iteration of the loop. This caught me off guard, and for a minute I thought it was immediately incrementing the iterator. Only when I breakpointed on both the line of the for loop and on the first line inside my loop did I realize what was happening. The debugger stopped on the first line of my loop, not when it executed the condition the first time. This does not seem like standard debugger behavior at all. Does this happen to everyone? I know if you define the iterator inline, the debugger stops. Huh.

Tags: ,

Leave a Reply: