zoukankan      html  css  js  c++  java
  • 在Flash Builder中使用条件编译

           在开发过程,由于代码调试的需要,会使用很多trace来输出信息或者其他测试函数,所以在发布时屏蔽这些代码会比较麻烦。而FB允许自定义宏,可以轻易地解决此问题。

    1、添加自定义宏

            宏定义的有固定的格式: -define=namespace::variable_name,value

            

    2、获取宏的值


    trace(CONFIG::debug); ——–output:true
    trace(CONFIG::release ); ——–output:false


    3、使用宏


    public class Test extends Sprite
    {
        public function Test()
        {
              init();
        }
    
        CONFIG::debug{
         
          private function init():void
          {
               trace('debug init');
          }
        }
       CONFIG::release{
           private function init():void
          {
              trace('release init');
          }
      }
    }

    //当设置-define=CONFIG::debug,true
    ———output:debug init

    //当设置-define=CONFIG::release,true
    ———output:release init

    ps:当-define=CONFIG::debug,true和-define=CONFIG::release,true时,使用时冲突;当都设为false时,不起作用。


  • 相关阅读:
    modal
    NSSpeechSynthesizer 文字变语音
    AVFoundation 初识
    语系/地区码
    Mac 平台下安装 OpenVC
    19-iOS图形性能
    01-产品发布10个大坑
    18-NSString之Strong和copy
    17-xcode6插件开发入门
    16-不能错过的Xcode插件
  • 原文地址:https://www.cnblogs.com/in1ts/p/3572481.html
Copyright © 2011-2022 走看看