Debugging nested Actionscript functions - see outer scope?

Suppose I have an Actionscript function like the following (line numbers included for reference):

1     private function foo() : void
2     {
3       var outerVar : Number;
4     
5       outerVar = 3;
6
7       doSomething();
8
9       return;
10
11      function doSomething() : void
12   {
13        var innerVar : Number;
14
15      innerVar = outerVar * 2;
16
17      trace(innerVar);
18    }
19  }

If I'm debugging along, and I hit line 15, the debugger will not show me the value of outerVar.  I suspect that's because it's not declared in the current scope.  However, it is visible in the current scope, because doSomething() is nested within foo().

Is there a setting I can change to make the debugger see this variable?  I know I can click up the call stack to see outerVar, but then I can't see innerVar - I often need to be able to see them at the same time.  We use a lot of nested functions for asynchronous RPC callbacks, so it's making debugging pretty difficult.

6 comments

I suggest to add 'outerVar' to Watches part of the Debugger tool window.

0

I've tried that, and what I get is:

outerVar     Cannot evaluate expression 'outerVar'

The same is true if I try using it in "Evaluate Expression".

0

In this case I'm afraid IDE can't get information that fdb tool from the Flex SDK doesn't provide.

0

AlexanderD wrote:

In this case I'm afraid IDE can't get information that fdb tool from the Flex SDK doesn't provide.


Is there any way it could detect that it's in an inner function and traverse up the stack internally?  The FlashBuilder debugger was able to give us this information, so maybe that's how they did it.

(I know that's a feature request, but I want to run it past you here for feasibility before I submit it.  Also, how would I go about doing that if I wanted to?)

Also, I know I'm posting a lot of "Flash Builder did X" questions here, and it may sound like I'm pining for the good old Flash Builder days.  Most definitely not!  What you're not hearing are the daily "hey, guys!  Check out THIS feature in IntelliJ that FB doesn't have!" and "Hey, I just made a change, built, and ran, all in three minutes instead of twenty!" and "Hey, IntelliJ hasn't crashed on me all week!".  But where there are bits and pieces that FB did better, I'm posting here to ty to emulate them or find workarounds.

0

This possibility needs to be investigated. You can file a feature request in our issue tracker under 'Flash_Flex' subcategory.

0

Thanks, Alexander.

For anyone else interested in this, I've created Issue 124287 for this.

0

Please sign in to leave a comment.