Ok, another hack, this time related to not being able to debug in Flex builder. Flex builder is great, dont get me wrong, I mean its light years ahead and a few decades before modern development/debugging tools, which ironically include Eclipse, but even so, it has its share of problems. This one is related more to the flash player (debug version of it) and the communication between them.
First, if you want to debug from within Flex, you need to have the debug version of the flash player installed (http://www.adobe.com/support/flashplayer/downloads.html). Make sure you download the version of the player that suits your default internet browser(this if you dont play with the debugging settings in flex-you could just donwload the standalone debug player and set the debuger in project properties to start the swf instead of the html).
The problem…
If you have it properly installed, but when you try to debug, flex just wont break on your specified breakpoints, or you cant get the trace messages in the Console (Window/Console) you might want to check the Progress tab, you might have at least a working item there. If you decide to wait until the progress reachs 100% you might get a message box with the following error:
Launch failed
Failed to connect; session timed out.
Ensure that:
1. You compiled your Flash application with debugging on.
2. You are running the debugger version of Flash Player.
WTF??? …you think, I have the debug player installed, I ran the project in debug, so the debug symbols must be in.. what next ?
The cause…
Now lets assume that you are like me and work on a lot of other things and have a lot of other applications installed on your development machine. If you are using windows (I’m almost sure this doesnt happen on MacOS), you might have some virtual network adapters or for example, vmware installed. If this is the case, you might do a simple check, open a windows console, at the command prompt try to ping localhost (by default the debugger connects to the debugged application using the localhost-loopback interface). If you get a reply from anything else but 127.0.0.1 you are in luck since the solution below will probably fix your problems. This being said, it is clear by now that the debugger and debugee are trying to communicate over sockets opened on different interfaces.
The solution(s)..
Depending on how much you want to tinker on this, you have 2 options, fix the localhost to point to the loopback interface (since some application changed this, if you correct this, it might break that application) or the easy way, just point the flash player to the correct interface/debugger. This is pretty simple, atempt to debug the application again (this will start the browser), right click on the flash object, from the context menu choose Debugger and there, select Other machine and the the text field, the ip of your loopback- “127.0.0.1″.
To “properly” fix this, you might want to open \windows\system32\drivers\hosts file in your favourite editor and make sure that there is only one entry for localhost, or if there are more, make sure that the last one looks like this:
127.0.0.1 localhost
Again, this might break the application that changed it in the first place…
done..
dw.