How to set up Flex debugging for web app page that contains Flash content

Our project has a "web" module that contains some Flex sources.  The people who developed the flex stuff are long gone.  Our Ant build script compiles the flex sources to create the SWF files and put them the right place so that pages that have Flash content work correctly.  But now I want to debug the flex code, and I have no idea how to make that work.  From the documentation, I know that I need to add a Flex facet to the web module, and I know I need to create a flex run-config, so I did both of those things, but I'm struggling with what to enter in the run-config: (for example I don't even know what the "main class" is).

My question really boils down to this:  given that someone who is no longer here created these flex files and the accompanying ANT build scripts to compile them, how do I set up IDEA to do the build itself instead of ANT, and moreover, how to get debugging working, so that I can set breakpoints, modify flex source files, rebuild, and debug again.

Googling on this subject didn't help much as it seems most people describe how to create Flex applications in IDEA, not how to debug Java web apps that have a Flex facet.  Does anyone know a good article to read for this?  Or could you provide a brief one here?  Thanks in advance.

5 comments
Comment actions Permalink

Hi Larry!

Do you have correct highlighting of ActionScript/MXML files in IDEA? If you do then probably you already have your project correctly configured. I'm afraid you do not.

Minimal steps to start debugging are:
- Configure new IDEA module of "ActionScript/Flex" type, set correct Flex SDK at Dependencies tab and add Flex source folders at Sources tab.
- You can skip configuration of Flex compilation in IDEA and continue compiling with already working ant. Just make sure that ant compilation creates debuggable SWF and that Flash Player (browser plugin) is a debugger one.
- Create run configuration: Run | Edit Configurations... | [+] | Flex run configuration. Select 'debug already running Flash Player', uncheck 'Make before launch'.
- Click Debug button in IDEA
- Launch your app. It should connect to IDEA's debugger automatically.

Java module with Flex facet is the same as Flex module that I suggested. The difference is that you can have several facets per module, i.e. produce several SWFs from the same sources when compiling in IDEA. I think you don't need this.

0
Comment actions Permalink

Thank you Alexander, that was just the information I needed.  I haven't had time to get back to this problem yet, but I feel sure that it will work when I do try, and I sure appreciate your reply.

0
Comment actions Permalink

>>Do you have correct highlighting of ActionScript/MXML files in IDEA? If you do then probably you already have your project correctly configured. I'm afraid you do not.

I see a lot of red, so I must assume that the IDEA flex build is not set up correctly.  But if I understood your message, this doesn't matter as we won't be using IDEA for compilation, we use the ant build.  So after following all of your instructions, I am able to get the debugger connected to the swf file by right-clicking it and choosing "Debug", but it doesn't stop at breakpoints that I have set in the source files.  Does this mean I need to set up IDEA build correctly before this will work?

0
Comment actions Permalink

Please disregard previous post, I got it working!  The one thing I had not done (or should I say, was not set up correctly when I found it) was specify the source folder for the facet.  Once having done that, your method works beautifully.  Thanks again, Alex.

0
Comment actions Permalink

I still suggest you to spend some time to get project correctly highlighted. So far you are using only 10% of IDEA capabilities.

0

Please sign in to leave a comment.