| Previous | Next |
Debugging your application in Flex -- NATIVELY!
If you are developing an application using Flex, you can debug your application NATIVELY within the Flex debugger with valid mProjector return values and full desktop functionality.
The trick to debugging in Flex is to change your "launch configuration" target to be the mProjector application created from your Flex SWF instead of the standard Flex web application. Once modified, you can can run your application using the "Run" menu or run/debug buttons in the Flex Debugging workspace.
- In the Flex Navigator view, select a project. Build your SWF.
- Open mProjector and build your application with the project's debug SWF. If your project name is HelloWorld, your debug swf with be called "bin-debug/HelloWorld.swf" by default.
- Open the Create, Manage, and Run Configurations dialog box.With a project file open in the code editor, right-click (Control-click on Macintosh) to display the pop-up menu and select Run As > Run or Debug As > Debug.
The Create, Manage, and Run Configurations dialog box appears.
- Select the launch configuration to edit. A number of configurations may be listed if you have other projects in the workspace, if you've set other project files as application files, or if other Eclipse plug-ins are installed. By default, the first time you run a project, Flex Builder creates a project-specific launch configuration, which is based on the default Flex application launch configuration.
- Click the "Main" tab, uncheck the "Use defaults" check box and enter the path to your mProjector application. For the Mac, add "/Contents/MacOS/mPlayer" to the end of the application path.
- To "Run" your application from inside Flex repeat steps 2-6 with your non-debug content, in this case with a new application using "bin-release/HelloWorld.swf".
- After any changes to your ActionScript, recompile your SWF, rebuild your application in mProjector, and relaunch your app in the Flex Debugger.
First build your swf. Then open mProjector and build your application with the project's debug SWF.
mProjector enables you to track the execution of your application using the trace methods: mApplication.trace() and mApplication.enableAutoTrace()
The mApplication.enableAutoTrace() method enables or disables automatic tracing of all mProjector commands. When auto tracing is enabled, mProjector will post mProjector function names and parameter values to the trace window. The mApplication.trace() method displays the specified text string in the trace window.
Debugging your application in Flash.
Nothing here has changes since the last version. If you are developing using Flash, you will use mApplication.trace() and the Console window (on the Mac or TraceViewer on the PC) to debug your application at runtime.
mProjector functionality is only available after the SWF is compiled into an application and NOT at SWF runtime in the Flash debugger. For example, when playing as SWF in the Flash IDE calling mWindow.center() does not move the window. If autotracing is on, which you can set with mApplication.enableAutoTrace() (and passing "true" as the only parameter), you will see the command trace to the Flash IDE window but nothing will happen. The method becomes effective once the SWF is compiled into an application and run.
Design Time Debugging
mProjector trace messaging will appear in the Flash IDE Output window if you include the mTracer component in the first frame of your movie. This tracing is limited to messages, parameters, and results provided from the Flash Player only. mProjector function return values are not avaliable in the Flash IDE.
For example, if you enable auto tracing, mProjector function calls and their corresponding parameter values sent to mProjector will appear in the Output window. If you were to call mWindow.setSize(x, y), where x=100 and y=200, you would see "mWindow.setSize(100, 200)" in the Output window. However, tracing an mProjector return value will show undefined or no message in the Output window. If you were to call mApplication.trace(mWindow.getSize().toString()), the corresponding line in the Output window would be "undefined".
NOTE: The mTracer component is not required for runtime functionality, but can be helpful by providing design time tracing. The component has no effect at runtime, and can be removed once development and testing is complete.
Run Time Trace
On Windows, the trace messages are posted to the TraceViewer application during execution of your application. The TraceViewer app ships and installs with mProjector Windows. You can launch TraceViewer from mProjector’s submenu in the Start Menu. The mWindow.setTraceColor() (Windows Only) sets a window’s custom trace color in TraceViewer. This color will be used by all trace commands issued by the window which made the call.

On the Mac, all trace messages are posted to the OSX Console application during execution. You can find the Console application in the Applications/Utilites directory.
| Questions or Feedback? | Previous | Next |
- AS2 Migration
- Getting Started - Flash
- Debugging in Flash
- Building your application from inside Flash
- Getting Started - Flex
- Debugging in Flex
- Using mProjector - Compile Your SWF into an Appli
- Customizing The About Window
- Debugging Your Application
- Launching Application at Startup
- Mac vs. Windows Application Development
- Menus
- Dynamic Window Creation
- Application Basics
- mProjector Class Basics
- Add Remove Programs Control Panel
- Fullscreen and Center
- Check Connection and Download File
- Choose Files
- Creating an Installer
- Creating and Controlling Multiple Windows
- Cut, Copy, and Paste (Windows)
- Desktop Shortcut and Start Menu Support
- Drag and Drop Files
- Embedding HTML and other Media types
- Flash-Shaped Windows
- Message Box
- Open Documents
- Project Files
- Reading and Writing to Hard Drive
- Startup Application
- Wallpaper and Screensaver
- Window to Window Communications
- Working with Included Files
- Context Sensitive Menus
- Alert User
- Screen Resolution

