2010-11-20 19 views
1

當我在瀏覽器中測試我部署的應用程序時,即使應該關閉彈出窗口,它仍會繼續顯示。在Flash Builder 4中調試時,一切都按預期工作。部署的柔性小應用程序未處理Web服務結果

以下是當前正在發生的事情:將請求發送到我處理請求的寧靜Web服務(看起來),調用ResultEvent,然後調用profileEvt動態改變視圖狀態的事件。但是,彈出式窗口不會關閉,並且小程序會「卡住」。

任何人都知道可能是什麼問題?下面是柔性小應用程序的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> 

回答

0

我不熟悉com.profs.ui.components.progressPopUp組件,但它是可能的closePopUp()方法中有一個錯誤。您可以嘗試直接使用PopUpManager方法刪除ProgressPopUp。例如,而不是:

_progressPopUp.closePopUp(); 

嘗試

PopUpManager.removePopUp(_progressPopUp); 

我也不知道把我的頭頂部什麼倒閉的規則(即在該點是_progressPopUp變量複製到ResultEvent.RESULT事件處理程序,您可以嘗試在實際創建_progressPopUp實例的行下移動該特定事件處理程序。

相關問題