This content has been marked as final. Show 6 replies
Check out the flash.system.Capabilities class and particularly the isDebugger property.
Thanks for your reply. Unfortunately, the code below still shows the stats when I have exported the project as a release build. Any other suggestions?
Did you test it on different versions of the player?
It has to work.
isDebugger detects whether or not the app is running under the debug version of Flash, not whether the app was built for debugging.
"This property is set to true when running in the debug version of Flash Player or the AIR Debug Launcher (ADL)."
I detect this by checking for a command-line setting, there must be a better way though:
// See if "-define+=BUILDINFO::release,true" was specified on the command-line.
var release:Boolean = false;
var BUILDINFO:Namespace = new Namespace("BUILDINFO");
release = Boolean(BUILDINFO::release);
// 'release' wasn't specified on command-line.
When I try your code it always fires the error ('release' wasn't specified on command-line). Do you have to use the Flex html-wrapper for your SWF? Because I'm developing without it.
And how exactly would I apply your code to the code I posted before? Because I don't really get what it does. Does it return 'true' when the build is a release build?
var isDebug:Booleab = (new Error().getStackTrace().search(/:[0-9]+]$/m) > -1);
Here are the sources that I found this answer...
Here's yet another take on solving this issue by using the compiler argument:
Personally I prefer the above solution.