我使用的是一个Adobe Flex项目的MVC MATE。在我们的页面之一,我们呈现给显示他们来自RPC信息的用户的对话窗口。其中,该对话框弹出的页面是无关的显示,所以这是一个单独的模型数据。如何创建一个MATE映射文件,将创建对话框窗口,使其对用户可见,然后将数据从模型中注入?

感谢阅读。

有帮助吗?

解决方案

好像你找到了一个办法,但如果你有兴趣的另一个想法,有关于如何在择偶接近弹出窗口的伴侣论坛一个很好的线索。它包括一些示例代码和讨论所涉及的最佳实践和为什么某些选择正在作出:

与弹出窗口交配<<伴侣论坛 <转换应用/ p>

如果我理解正确的话,这里是一些代码,你需要什么(改编自该线程)。它注入RPC调用到视图的结果(保持地图不可知怎么视图显示的数据),视图将创建一个弹出每当有数据,并删除弹出时没有数据。螺纹具有的最此代码的进一步解释。

EventMap:

<Injectors target="{PopupParentView}">
    <PropertyInjector destinationKey="rpcData" 
                      source="{FooManager}" sourceKey="rpcData" />
 </Injectors>

PopupParentView:     ...     

private var popup : UIComponent;

private var rpcData : Object;

private function onPreinitialize( event : Event ) : void {
    BindingUtils.bindSetter(rpcDataChanged, this, "rpcData");
}

private function rpcDataChanged( value : Object ) : void {
    invalidateProperties();
}

override protected function commitProperties( ) : void {
    // two mutually exclusive branches: either the property can be interpreted as "show the popup"
    // and the popup doesn't exist, or we shouldn't show the popup, but it does exist. all other
    if ( rpcData != null && popup == null ) {
        popup = PopUpManager.createPopUp(...);
    } else if ( rpcData == null && popup != null ) {
        // make sure to set the popup property to null
            PopUpManager.removePopUp(popup);
            popup = null;
    }
}
</Script>
...
scroll top