【发布时间】:2015-03-15 11:23:13
【问题描述】:
我需要对 AS3 变量进行条件编译。
问题:
有没有办法在类级别进行 if-else 条件编译,使用单个编译参数?
详情:
这行得通:
CONFIG::DEBUG {
public var myVar:int = 0;
}
但我需要 if-else 块(失败):
CONFIG::DEBUG {
public var myVar:int = 0;
} else { // ERROR: no if for else...
private var _myVar:int = 0;
public function get myVar():int {
return _myVar;
}
}
我也不能在类级别使用有效的 if-else 块:
if (CONFIG::DEBUG) { //ERROR: can't have if statement at class scope.
//debug stuff
} else {
//release stuff
}
我可以使用 2 个参数,但我想避免它。
感谢您的宝贵时间。
【问题讨论】:
标签: actionscript-3 conditional-compilation