你怎么知道编程方式,如果一个Flex应用程序在调试模式下运行? [英] How can you tell programmatically if a Flex App is running in debug mode?

查看:128
本文介绍了你怎么知道编程方式,如果一个Flex应用程序在调试模式下运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以写code中,将只在调试版本上运行,或通过调试运行时,Flex应用程序? 有没有的Flex提供了一种真正删除code完全由发布版本,如C风格的#define?

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

解决方案

您可以做条件编译这样的:

  CONFIG ::调试{
    //如果CONFIG ::调试解析错误在编译时,这将被删除
}
 

然后把它添加到编译器标志:

  -define + = CONFIG ::调试,真
 

有关调试版本,以及

  -define + = CONFIG ::调试,假
 

有关发布版本。 配置调试可以是任何东西,如 MY_AWESOME_NAMESPACE foobar的,也没关系。

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

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

for debug builds, and

-define+=CONFIG::debugging,false

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

Read more here: Using conditional compilation.

这篇关于你怎么知道编程方式,如果一个Flex应用程序在调试模式下运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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