【问题标题】:Optional compile in Flash BuilderFlash Builder 中的可选编译
【发布时间】:2014-10-23 15:07:30
【问题描述】:

有没有办法告诉 Flash Builder 4.7 选择性地编译某些行?

即现在让我们说一个应用程序有这样的行:

if(DEBUGMODE) {
trace("foo");
}

与其不显示,我希望它甚至不将该跟踪行(作为字节码)编译到 SWF/AIR/等中,并在给定某些指令的情况下在整个应用程序中切换它。

【问题讨论】:

    标签: actionscript-3 flash apache-flex flash-builder


    【解决方案1】:

    你正在寻找条件编译,这个链接应该可以帮助你:http://www.flexer.info/2010/03/04/how-to-create-conditional-compilation-definitions-conditional-compile-blocks/

    基本上,您需要将-define+=CONFIG::development,true 添加到您的编译器选项中

    然后,在您的代码中,您将像这样创建一个条件块:

    CONFIG::development {
        // this is a conditional compile block
        // it will only compile if CONFIG::development is set to true in your options
    }
    

    【讨论】:

      猜你喜欢
      • 2011-02-09
      • 2012-02-29
      • 2012-12-22
      • 2014-05-16
      • 2011-06-13
      • 2011-06-23
      • 1970-01-01
      • 2017-05-18
      • 1970-01-01
      相关资源
      最近更新 更多