Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/apache-flex/5.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 绑定mxml(as)_Apache Flex_Actionscript 3_Data Binding_Mxml - Fatal编程技术网

Apache flex 绑定mxml(as)

Apache flex 绑定mxml(as),apache-flex,actionscript-3,data-binding,mxml,Apache Flex,Actionscript 3,Data Binding,Mxml,我有一个带有绑定{someBinding}的actionscript文件 Main.mxml是所有操作发生的地方。如果我在标签组件的“文本”中设置{someBinding},我将有一个数字 我有另一个form.mxml文件。我希望那个绑定在哪里,但它找不到这样的绑定 我需要在另一个mxml中使用{someBinding},方法与Main.mxml相同 谢谢,Yan您不能按照您要求的方式将一个组件(或文件)中的值转换为另一个组件(或文件)中的值。您必须将这些相关值作为属性公开,并设置这些值 这种方

我有一个带有绑定{someBinding}的actionscript文件

Main.mxml是所有操作发生的地方。如果我在标签组件的“文本”中设置{someBinding},我将有一个数字

我有另一个form.mxml文件。我希望那个绑定在哪里,但它找不到这样的绑定

我需要在另一个mxml中使用{someBinding},方法与Main.mxml相同


谢谢,Yan

您不能按照您要求的方式将一个组件(或文件)中的值转换为另一个组件(或文件)中的值。您必须将这些相关值作为属性公开,并设置这些值

这种方法应该在以下方面起作用:

首先将属性添加到组件2并使其可绑定。在脚本块中执行此操作,如下所示:

[Bindable] public var hBoxWidth : int;
然后将其绑定到同一组件的MXML中,如下所示:

<mx:HBox width="{this.hBoxWidth}" />

现在,某些组件将包含以下组件:

<mx:HBox>
  <myCustomComp:customHBox hBoxWidth={this.othervalue} />
</mx:Hbox>

因此,当othervalue更改时,它将更改customHBox组件上的hBoxWidth值,这将反过来更改customHBox内部HBox上的width属性


这有意义吗

您可以创建绑定,但必须使用ActionScript,并且需要对main.mxml中的form.mxml文件进行引用(反之亦然)

这会让你对它的工作原理有一个理想的认识。看看BindingUtils的语法。bindProperty方法。BindingUtils代码将在main.mxml中使用

BindingUtils.bindProperty(otherForm.someOtherTextComponent, "text", this.someTextComponent, "text");

我已经合并了两个文件,现在它可以工作了。。。但是如果你想回答的话,那就说:D