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
Apache flex 将集合函数作为参数传递_Apache Flex_Function - Fatal编程技术网

Apache flex 将集合函数作为参数传递

Apache flex 将集合函数作为参数传递,apache-flex,function,Apache Flex,Function,如何将“set”函数作为另一个函数的函数对象参数传递? 例如: 在上面的示例中,“id”参数正在求值并返回一个字符串,因此它不会编译并出现错误:“String不可分配给Function类型的参数” 谢谢在这种情况下,您不需要这样做;您可以改用BindingUtils.bindProperty: BindingUtils.bindProperty(this, "id", source, "id"); 但如果您真的想使用bindSetter和函数,您可能可以: BindingUtils.bindS

如何将“set”函数作为另一个函数的函数对象参数传递? 例如:

在上面的示例中,“id”参数正在求值并返回一个字符串,因此它不会编译并出现错误:“String不可分配给Function类型的参数”


谢谢

在这种情况下,您不需要这样做;您可以改用
BindingUtils.bindProperty

BindingUtils.bindProperty(this, "id", source, "id");
但如果您真的想使用bindSetter和函数,您可能可以:

BindingUtils.bindSetter(function (arg:*): void { id = arg; }, source, "id");

引用“id”将调用它的getter。您好,James,正如Markus在下面指出的,在这种特殊情况下,我可以使用bindProperty,但我想封装id属性,因为在我的实际代码中,“set”函数对传递的值执行一些工作。马库斯的第二个解决方案是通过事物的外观来实现的,这就是我们为“get”和“set”关键字提供的精确性所付出的代价吗?
BindingUtils.bindSetter(function (arg:*): void { id = arg; }, source, "id");