Actionscript 3 Flex 3使用.as中的条件绑定布尔值
我想在actionscript中绑定一个带条件的布尔值。这在mxml中是可能的,但是如何在actionscript上实现呢 例如: .mxml绑定:Actionscript 3 Flex 3使用.as中的条件绑定布尔值,actionscript-3,apache-flex,flex3,Actionscript 3,Apache Flex,Flex3,我想在actionscript中绑定一个带条件的布尔值。这在mxml中是可能的,但是如何在actionscript上实现呢 例如: .mxml绑定: enabled={(A_changed || B_changed || C_changed || D_changed) && rs.selectedIndex !=-1}/> .具有约束力: BindingUtils.bindProperty(this.myBtn,'enabled',????); 谢谢,
enabled={(A_changed || B_changed || C_changed || D_changed) && rs.selectedIndex !=-1}/>
.具有约束力:
BindingUtils.bindProperty(this.myBtn,'enabled',????);
谢谢,
Dave对于您的问题没有懒惰的解决方案-Flex编译器正在MXML绑定中进行大量转换,而这在vanilla AS3中是不可用的。您必须附加到所有属性。比如:
var closure:Function = function(...triggers):void {
enabled = (A_changed || B_changed || C_changed || D_changed) && rs.selectedIndex !=-1;
}
BindingUtils.bindSetter(closure, this, "A_changed");
BindingUtils.bindSetter(closure, this, "B_changed");
BindingUtils.bindSetter(closure, this, "C_changed");
BindingUtils.bindSetter(closure, this, "D_changed");
BindingUtils.bindSetter(closure, rs, "selectedIndex");