Note: An update to this topic has been posted here. It provides a better solution than the one offered below, so I recommend you check it out before continuing.
Have you ever had a Flex application that worked fine in your development environment but not when you moved it to your production server? How do you debug the problem?
You can use the following trick to enable Flex Builder to establish a debug connection to a remote server.
-
First, compile a debug version of the application and deploy it to your remote server.
-
Then go into the project’s properties in Flex Builder (Project >> Properties >> Flex Build Path) and change the “Output folder URL” to an invalid URL (this can be almost anything).
-
Compile your application again in debug mode. This time, Flex Builder will launch the invalid url and will not be able to connect to the debugger.
-
While Flex Builder is waiting to connect to the debugger, navigate to the debug SWF that you put on your remote server. Don’t forget to include
?debug=true in the querystring.
-
Flex Builder will connect to the remote swf the same way it would have connected to your local version. You can use breakpoints, inspect variables, and do everything you could do locally.
This trick comes in really handy when you have problem related to a specific environment. I hope this can help ease the pains of debugging for some of you.