Recently I had to profile one of my Flex projects, but found that I got endlessly trapped by an error look like the following:

Error #2044: Unhandled securityError:. text=Error #2048: Security sandbox violation: file:///some_path/.metadata/.plugins/com.adobe.flash.profiler/ProfilerAgent.swf?host=localhost&port=### cannot load data from localhost:###

I have tried to install/uninstall Flash debug player as well as Flash Builder, but both still yielded the same error.  It has taken me some time to find out a solution to get profiler working.

Step 1: Make sure the ProfilerAgent.swf is allowed in Flash’s global security setting

This is done by adding the location of the ProfilerAgent.swf in Flash Player’s Trusted Location Settings.  The setting may be changed in Windows’ Control Panel as screenshot below:

Step 2: Edit mm.cfg file to enable Profiler

To locate the mm.cfg, type in %HOMEDRIVE%%HOMEPATH% in Windows Explorer’s address bar, or follow the instruction here.  Open the mm.cfg in Notepad or your favorite text editor.  The configuration in mm.cfg is a bunch of simple setting=value.  Adobe only provides a subset of settings in their instruction, but there are a lot more undocumented settings.  To cut to the chase, make sure the following settings are in mm.cfg

 ProfileFunctionEnable=1
 ProfilingOutputFileEnable=1
 RendererProfilingEnable=1

Save the changes, and restart the profiler (no computer restart necessary), and ditto!

Advertisements