私はCairngormよりもMateに精通していますが、この状況で私が行うことは、モデルを使用してポップアップをバックアップし、モデルからイベントをディスパッチすることです。モデルとメインアプリケーションは同じレベルにあるため、メインアプリケーションはイベントを聞くことができます。
アップデート:
これが大まかな例です。
MainMap.mxmlで、プレゼンテーションモデルのインスタンスを作成し、それをポップアップに挿入します。
<EventHandlers type="{ FlexEvent.PREINITIALIZE }">
<ObjectBuilder generator="{ MyPopUpPresentationModel }" constructorArguments="{ scope.dispatcher }"/>
</EventHandlers>
<Injectors target="{ MyPopUp }">
<PropertyInjector targetKey="model" source="{ MyPopUpPresentationModel }"/>
</Injectors>
そして、MyPopUp.mxmlには、モデルのインスタンスがあります。
<fx:Script>
<![CDATA[
[Bindable] public var model:MyPopUpPresentationModel;
]]>
</fx:Script>
これがMyPopUpPresentationModel.asです。
package
{
private var dispatcher:IEventDispatcher;
public function DigitalTagTrackingPresentationModel(target:IEventDispatcher)
{
this.dispatcher = target;
}
public function dispatchMyCustomEvent():void
{
dispatcher.dispatchEvent(new Event("MyCustomEvent"));
}
}
MyPopUp.mxmlmodel.dispatchMyCustomEvent();
から呼び出すと、親アプリケーションと同じレベルにあるプレゼンテーションモデルのディスパッチャーのスコープを使用してイベントがディスパッチされます。これがお役に立てば幸いです。