views:

903

answers:

2

Is there a way using Flash (CS3+AS3) to determine if the published swf is running in a debug player or in Flash's debug mode?

I'm aware that Flex provides the ability to setup different build targets (release/debug) and that you can use something like CONFIG::debug for #ifdef style inclusion of code at compile time.

I'm imagining something like System.isDebug() but can't find anything. I want to use this because there's debug functionality in my app that I definitely don't want to be available in a production environment.

+5  A: 

Capabilities.isDebugger

Antti
Exactly this, except it's a property, not a method, so the parentheses should be removed.
hasseg
Nice catch, fixed :)
Antti
Oh, _snap_! Thanks!
aaaidan
+5  A: 

check out this class http://blog.another-d-mention.ro/programming/how-to-identify-at-runtime-if-swf-is-in-debug-or-release-mode-build/

The one you're refering to as System.isDebug() is actually Capabilities.isDebugger but returns true if the use have Flash Player Debuger version and not if he's running a swf built in debug or relase mode.

The class there has a function that tests for both situations.

TheBrain