I have a PureMVC Flex project I'm working on at the moment. Because the data is powered by (ugh) .NET Web Services, I am stuck dealing with myriad Flex encoding/decoding problems. In particular, I am trying to send a complex object from the Flex application to a particular .NET method.

No matter what I try, there's an encoding error within Flex when I go to send the object to the WS's method. One of the biggest headaches is the fact that I cannot get any real details on the issue. When I debug, I can see the encoder and decoder have resulted in a #1009 Error (null object). Annoying!

In order to try and see what the hell was going on under the hood, I decided to check out Kap Lab's PureMVC Console. This utility allows a developer to check out all the action going on in PureMVC (mediators, proxies, etc.).

I wasn't able to get it working per the instructions but found an alternate way. In the instructions, the good folks at Kap Lab were trying to make it less work to use the PureMVC console for development and not have to recode anything when you export the production release. I prefer the extra work (since it functions correctly).

Get PureMVC Console Working
  1. Download the application (URL above but you need to create a free account with Kap Lab)
  2. Unpack/unzip the archive
  3. Copy the expanded folder/files to a location on your computer (I put all of mine in a Flex folder off my web root)
  4. In Flex Builder, right click on your project and select properties
  5. Select Flex Build Path from the list on the left
  6. Select the Library Path tab in the main window
  7. Click the button to Add SWC
  8. Locate the PureMVCConsole.swc file that you downloaded and unpacked in steps 1,2 and 3
  9. Include it
  10. Repeat step 8 for the KapITFXPatches.swc if you are using HTTPService or Remote Objects or Web Services in your application (and you want to track these)
  11. Change your Application Facade to read as follows:

import fr.kapit.puremvc.as3.patterns.facade.DebugFacade; 
public class ApplicationFacade extends DebugFacade{ //other ApplicationFacade code here as usual }
In your main Application MXML file (mine are always called App.mxml), add the following:

... other code ...

Viewing the Console in Your Application
To view the console in your application (once it's running in a browser), you need to press a set of keys. On a PC it's CTL+ALT+CLICK or CTRL+ALT+F6. On a Mac, select CMD + SHIFT + CLICK to open the console.

Export Production Release
The only other step comes when you launch your application With that, you can start tracking all PureMVC actions. It's pretty sweet, really. Nice to visually see what happens with the framework as you use an application and it's a great way to truly understand how PureMVC works (they have a Cairngorm app, too). When you're ready to export a production release, just remove the PureMVCConsole tag from the Application component and change the ApplicationFacade declaration back to the standard for Flex
public class ApplicationFacade extends Facade implements IFacade

Recompile for the production release and you're good to go!

Comments

Craig Kaminsky
@power123: It might be because of how the necessary classes were included in the application. It was definitely tricky! Feel free to post back with some code or more questions. Happy to help!

You might want to take a look at the other debugger I've written about:
DeMonster Debugger
http://craigkaminsky.blogspot.com/2009/05/flex-excellent-air-debugger-for-flex.html

It's easier to setup and very helpful.
power123
I am not getting and i would to ask that how kap it console for pure mvc is included into the flex project

i installed the swc into the libs but ,,after that when clik ctrl+alt+clcik ,, i got the component but not got the data