Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/search/2.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 重新加载主窗口';弹出窗口中的s变量_Apache Flex_Popup - Fatal编程技术网

Apache flex 重新加载主窗口';弹出窗口中的s变量

Apache flex 重新加载主窗口';弹出窗口中的s变量,apache-flex,popup,Apache Flex,Popup,我有一个关于如何从弹出窗口访问主窗口变量的问题 我在主窗口中创建了一个弹出窗口,并将变量“content”传递给该弹出窗口,如下代码所示: <mx:Script> <![CDATA[ // ...... popwin = PopUpManager.createPopUp(UIComponent(parentApplication), PopupWindow, true) as PopupWindow; popwin.parentView = th

我有一个关于如何从弹出窗口访问主窗口变量的问题

我在主窗口中创建了一个弹出窗口,并将变量“content”传递给该弹出窗口,如下代码所示:

<mx:Script>
    <![CDATA[
    // ......
    popwin = PopUpManager.createPopUp(UIComponent(parentApplication), PopupWindow, true) as PopupWindow;
    popwin.parentView = this; // parentView is an IFlexDisplayObject
    popwin.content = content;
    PopUpManager.centerPopUp(popwin);
    // ......
    ]]>
</mx:Script>
主窗口中的代码片段:

addEventListener(CustomEvent.RESET, resetContent);

public function resetContent():void{
    this.content = loadContent();
}
但popwin中“内容”的值不会重置

有什么我错过的吗

是否有其他方法更新弹出窗口中的“内容”

===========================问题更新日期:2011年8月15日==============================

我在popwin的createComplete()函数中使用以下代码:

BindingUtils.bindProperty(textInput, "text", content, "name", false);
当我更改textInput的文本值并重置内容时,它会在跟踪日志中加载content.name的原始值,但textInput的文本值不会恢复为原始值

如果我使用以下代码代替BindingUtils.bindProperty:

[Bindable]
public var content:Content;
......
<mx:TextInput id="textInput" text="{content.name}" />
[Bindable]
公共var内容:内容;
......
并执行相同的操作,content.name在我的跟踪日志中重新加载,但文本值在textInput中设置为空

有人知道原因吗?

尝试使用:

popwin = PopUpManager.createPopUp(UIComponent(parentApplication), PopupWindow, true) as PopupWindow;
popwin.parentView = this; // parentView is an IFlexDisplayObject
popwin.content = content;
BindingUtils. bindProperty(popwin, "content", this, "content", false, true);
PopUpManager.centerPopUp(popwin);

只需重新设置内容

public function resetContent():void{
    if (popwin != null){
     popwin.content = this;
    }
}

我想bindProperty可能有用,但对我来说不行。“内容”是popwin中的一个对象,它将是repeater组件的数据提供者。当我更改该中继器组件的文本值并尝试重置它时,它不会加载原始值。我尝试查找数据提供程序在重置时不更新的位置和原因。可能是因为其他原因。但是如果有人有什么建议,请在这里发表你的评论。非常感谢。在
this.content=loadContent()
行中,您将
this.content
的指针更改为内存的另一个区域,但popup的
content
属性的指针仍然指向上一个区域。而且数据绑定在ActionScript中不起作用。您可以使用
BindingUtils
调用绑定,我不明白为什么这个解决方案不适合您的体系结构,因为绑定非常适合您的需要?注释对于编辑复杂的内容来说非常困难,所以我更新了我的问题。我想您应该在单独的问题中提取您的更新。
public function resetContent():void{
    if (popwin != null){
     popwin.content = this;
    }
}