Did you know that it is not possible to debug loaded content within release (non-debug) build app? Every attempt to insert a breakpoint during the runtime will cause null pointer exception thrown by flash builder, however you can still trace() output. To be more specific, imagine you have main application deployed somewhere on the web and you want to debug a module you are just developing wrapped inside the main application. Sure you can use proxy mapping trick + custom run configuration, that would help you run your debugging version of module.swf, however while the main application is non-debug version, the flash builder debugger will just not work correctly. Luckily you have two options to make it work. First, you may also map the main application .swf file for your debug version (+ some flex rsl files) or second option, make the flash player wrap whole content into some .swf compiled in debug mode using PreloadSWF in mm.cfg.
To sum up whole process in steps:
- setup your proxy to map original module.swf file to your one in bin-debug folder
- in Flash Builder create run configuration using custom “URL or path to launch”
- define PreloadSWF property in mm.cfg file to target some .swf compiled in debug mode (see example below)
- restart your browser and run your custom run configuration
Generally, to make debugger work, the flash player has to run .swf in debug mode. To override (wrap) non-debug application you can use PreloadSWF targeting some simple .swf file in debug version:
package { import flash.display.Sprite; public class Debugger extends Sprite {} }
mm.cfg configuration
PreloadSWF=c:\somepath\Debugger.swf
Once you are already playing with PreloadSWF, you can instead target MicroProfiler.swf and profile every flash on the web.