Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging or Watching Static Variables within Flash Builder 4

Problem:

When I set a breakpoint and debug my application, Flash Builder 4 is not displaying static variables within the variables window. I can't seem to find a solution in other posts.

More detail:

I'm using flash builder 4 to execute flex unit tests on one of my AS3 classes. I set a static variable within the [Before] function, which is accessed in each of the tests.

I've set a breakpoint within one of the tests to see why it is failing, but I notice that static variables don't appear when I expand the 'this' object within the variables window. (In this case my static variable is the only variable associated with the class, so the only object in the variables window is the "this" object).

Question: Does anybody know how to make static variables appear in the variables window?

Thanks,

Cookie

like image 543
Cookie Avatar asked Dec 16 '10 00:12

Cookie


3 Answers

True, the Variables panel only shows non-static variables in scope.

BUT, you can use the Expressions panel to keep an eye on those static variables... even if they are private. Just type YourClass.staticVariable into a new Expression row, and it will watch your statics for you no problem at all.

You can also hover your mouse over the static variable and a tooltip will appear with the value.

Just for fun, I compared it to Visual Studio. The comparable panel is called "Locals" over there, and it DOES let you see static members while looking at instances... so, using VS as a precedent, you are not out of line for thinking that you might be able to do this in FB. But alas, use "Expressions" instead.

:)

like image 161
Brian Genisio Avatar answered Nov 20 '22 03:11

Brian Genisio


There's a filter for the variables view that determines what you'll see. On the top right of the variables panel is a menu button (the icon is an upside down triangle), click that, choose Flex from the drop-down and select 'Show Inaccessible Member Variables'.

Cheers!

like image 28
K0j0 Avatar answered Nov 20 '22 05:11

K0j0


I'm on Flash Builder 4.7 and none of the answers given by K0j0 and Brian Genisio applies. So far the only way I can debug a static variable is by assigning it to a local variable (thus had to modify the code). Hope there's a better way of doing this somehow

like image 27
gerrytan Avatar answered Nov 20 '22 04:11

gerrytan