Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/apache-flex/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Actionscript 3 Flex 3使用.as中的条件绑定布尔值_Actionscript 3_Apache Flex_Flex3 - Fatal编程技术网

Actionscript 3 Flex 3使用.as中的条件绑定布尔值

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',????); 谢谢,

我想在actionscript中绑定一个带条件的布尔值。这在mxml中是可能的,但是如何在actionscript上实现呢

例如:

.mxml绑定:

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");