如何以编程方式说明Flex App是否在调试模式下运行? [英] How can you tell programmatically if a Flex App is running in debug mode?

查看:154
本文介绍了如何以编程方式说明Flex App是否在调试模式下运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在Flex应用程序中编写代码,该应用程序只能在调试版本中运行,或者在通过调试器运行时编写代码?
Flex提供了一种完全从发布版本中删除代码的方法,如C-style #define?

Is it possible to write code in a Flex application that will only be run in a debug build, or when running through the debugger? Does Flex provide a way to actually remove code entirely from release builds, like C-style #defines?

应用程序不一定在网页中运行

The app is not necessarily running in a web page.

推荐答案

您可以执行如下条件编译:

You can do conditional compilation like this:

CONFIG::debugging {
    // this will be removed if CONFIG::debugging resolves to false at compile time
}

然后将其添加到编译器标志中:

And then add this to the compiler flags:

-define+=CONFIG::debugging,true

用于调试版本,

-define+=CONFIG::debugging,false

发布版本。 CONFIG 调试可以是任何东西,如 MY_AWESOME_NAMESPACE code> fooBar ,没关系。

for release builds. CONFIG and debugging can be anything, like MY_AWESOME_NAMESPACE and fooBar, it doesn't matter.

在这里阅读更多:使用条件汇编

这篇关于如何以编程方式说明Flex App是否在调试模式下运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆