デプロイされたアプリケーションをブラウザでテストすると、ポップアップウィンドウが閉じられた後でもポップアップウィンドウが表示され続けます。 Flash Builder 4でデバッグすると、すべてが期待どおりに機能します。profileEvt
ダイナミックを送出する(一見)ResultEvent
が呼び出され、要求を処理するわかりやすいWebサービスに要求が送信されます。ビューステートを変更するイベント。ただし、ポップアップウィンドウは閉じず、アプレットは「スタック」します。デプロイされたフレックスアプレットがWebサービスの結果を処理しない
誰かが問題になる可能性がありますか?以下は、フレックスアプレットのWebサービスイベントリスナー/ハンドラは、以下のとおりです。
webService.addEventListener(ResultEvent.RESULT, function(event:ResultEvent):void
{
var rawData:String = String(event.result);
var profileEvt:DynamicEvent = new DynamicEvent("profileSaved", true);
profileEvt.data = JSON.decode(rawData).profile;
dispatchEvent(profileEvt); // Dispatch profile saved event
_progressPopUp.closePopUp();
dispatchEvent(event); // Dispatch submit profile button clicked
});
webService.addEventListener(FaultEvent.FAULT, function(event:FaultEvent):void
{
Alert.show("Could not create profile; please try again later.\n" + event.message, "Status");
_progressPopUp.closePopUp();
});
var params:Object = {"profile" : profile};
try
{
_progressPopUp = PopUpManager.createPopUp(this, com.profs.ui.components.ProgressPopUp, true);
_progressPopUp.eventSource = webService; // Set source of progress events
webService.send(JSON.encode(params));
}
注: com.profs.ui.components.ProgressPopUp
は、カスタムコンポーネントです。そのためのコードは以下の通りです:
<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" layout="absolute" width="300" height="200" showCloseButton="false" title="Status" creationComplete="init()">
<fx:Declarations></fx:Declarations>
<fx:Script>
<![CDATA[
import mx.managers.PopUpManager;
[Bindable] public var eventSource:Object;
private function init():void
{
PopUpManager.centerPopUp(this);
}
public function closePopUp():void
{
PopUpManager.removePopUp(this);
}
public function completionHandler(event:Event):void
{
closePopUp();
}
]]>
</fx:Script>
<mx:ProgressBar id="progressBar" indeterminate="true" mode="event" source="{eventSource}" complete="completionHandler(event)" verticalCenter="0" horizontalCenter="0"/>
</mx:TitleWindow>