似乎你找到了一个方法,但是如果你对另一个想法感兴趣,在mate论坛上有一个关于如何在mate中接近弹出窗口的好帖子。它包括一些示例代码,并讨论了所涉及的最佳实践以及为什么要做出某些选择:
Converting app with popups to Mate << Mate Forums
如果我理解正确,这里有一些代码可以做您需要的事情(改编自该线程)。它将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>
...