Update: Debugging Flex on a remote server

Posted in Flex, How-To, Tips & Tricks on October 12th, 2009 by Kalen Gibbons

In a previous post I described a hack I used for debugging Flex applications on a remote server. Well, shorty after making that post I stumbled upon a much better way of doing this. Flex Builder actually has functionality built into it to allow remote debugging, you just need to know where to find it.

  1. First, compile a debug version of your application and upload it to your remote server.

  2. Second, go to the Run/Debug Settings panel by clicking Project >> Properties and selecting the Run/Debug Settings option from the list. There, you should see another list of launch configurations for your project. Most likely, you’ll only have one, which will match the name of your application. Select it and click on the “Edit…” button.

  3. Next, find the “URL or path to launch” section and deselect the “Use defaults” checkbox. Within the first text input titled “Debug,” place the URL to your remote server. This URL can point to the SWF file or to an HTML page that loads the SWF, the debugger will connect either way.
    If you’re connecting to the SWF directly you may need to add ?debug=true to your querystring. If you are connecting to an HTML page – make sure it loads the debug version of your SWF and not the release build.

  4. Finally, save your project properties and run the debugger as normal. You’ll see that the debugger will connect to the SWF file on your remote server and you can debug the same way you would locally, using breakpoints, expressions and everything else.

  5. That’s it… enjoy!


Tags: ,

Debugging Flex on a remote server

Posted in Flex, How-To, Tips & Tricks on July 2nd, 2009 by Kalen Gibbons

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.

  1. First, compile a debug version of the application and deploy it to your remote server.
  2. 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).

    Remote Debug: Bad URL
  3. 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.

    Remote Debug: Connecting to debugger
  4. 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.
  5. 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.

    Remote Debug: Debug Panel

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.


Tags: ,