Debugging Modules With Flex Builder (possible?)

January 11, 2007 at 6:20 am | Posted in flex2, Rich Internet Applications | 4 Comments

This is my first post in my “technical” blog … (another new year “purpose”)… Warning… my written english is really bad (english classes … another “purpose” for this year)…

I was trying to debug my app (that loads forms compiled in modules) with flex builder 2.0.1 ( installed as a plugin in eclipse 3.2.1) but it didn’t work… his is the description of my “environment” and steps to “reproduce” the “incident”:

1. The App: A Main application, A module with a breakpoint in the initialization method.

2. 05:33:16.156 [DEBUG] MyFlexApp This is a debug session… (ok… my app has been loaded…and my logger works fine… I had to make a “trick” to detect that the application was started in debug mode or normal mode… [sorry.. I`am a begginer in flex2..] )

3. The user selects an option of a MenuBar (the user wants to see a module of the application… )

4. 05:50:56.296 [DEBUG] AppWorkspace Loading Window: MySearchModule-debug.swf (ok… application is loading the correct debug.swf… according to “One-project model”)

5. My user is happy… he can see loading progress in a ProgressBar (easy… really easy… <mx:ProgressBar id=”progressBar” width=”80%” source=”{moduleLoader}” textAlign=”center”/> … forget old days of MovieClipLoader…)

6. Flex builder debugger freezes (mmmm this is not good…)

7. Firefox with flash debug player 9,0,15,0 freezes too (mmm .. did I say that my OS is WinXp?…)

8. Firefox with flash debug player 9,0,15,0 Crashes… (now my user isn’t happy and wants to kick my ass … I tell him that this is a new Feature of the product in te current build: “Close firefox directly from the MenuBar in the flex application“)

Firefox Error

9. 30 seconds trying to kill the crashed process…

10. Restart firefox, Restart eclipse.

11. Another test…and total crash repeats…

11. Post incident to flexcoders (maybe someone at adobe could read this … and give some advice 😛 ).

12. setInterval(this, “waitForHelpAboutDebuggingModules”, 1000*60*60); //old school…

13. Goto sleep.//old old school.

Update 2007/01/16
New Documentation here:

Modules documentation update

and here Debugging with Flex Modules where Kevin Hammer has a similar approach to my “experiment”… using the “this.url” trick in Application…
in addition.. when running in debug mode “generates” localhost gateway url for (debug only) connection with openamf running locally in tomcat…

My newbie “as3 and flex2” code is here:

In my main Application:

var pattern:RegExp = /MyFlexApp.swf/;
var baseUrl:String = this.url;
if(baseUrl.indexOf(“file://”, 0) > -1){
//Note: For local debugging Only
if(baseUrl.indexOf(“debug”, 0) > -1){
logger.debug(“This is a debug session…”);
MainAppModelLocator.getInstance().isDebugSession = true;
baseUrl = “;;
baseUrl = baseUrl.replace(pattern,””)+”gateway”;
} = baseUrl;

There is another component that “observes” user’s requests for loading new modules… the code is something like this:
public function observeShowModule():void{
var newWindow:MyWindow = PopUpManager.createPopUp(this,MyWindow, false) as MyWindow;

var moduleUrl:String = MainAppModelLocator.getInstance().currentShowModuleEvent.url;
var pattern:RegExp = /.swf/;
moduleUrl = moduleUrl.replace(pattern,”-debug.swf”);

logger.debug(“Loading Window: “+moduleUrl);



RSS feed for comments on this post. TrackBack URI

  1. mmm … maybe this could be the answer: 😦 (sadly…)

    Known issues

    * (Macintosh-only) Release a debug session – When an application throws a runtime exception (RTE) and you terminate a debug session, Flex Builder does not release the debug session when the browser window is closed. To fix the problem, completely close your browser with Command-Q.
    * Modules – Module tag source’s breakpoint is not hit if the MXML file is not included in a runnable application file.
    * Debugging with Firefox – Firefox is closed incorrectly and displays an error message upon error message on restart when closing a debug session.

  2. here there are some tips related to RSL’s and Modules…

  3. very interesting, but I don’t agree with you

  4. It was an issue in Flex Builder 2.0 fixed in 2.01

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Blog at
Entries and comments feeds.

%d bloggers like this: