2014-01-14 6 views
0

안녕하세요 저는 플래시 빌더 4.6을 사용하여 응용 프로그램을 만들고 AMFPHP을 데이터베이스 용으로 사용하고 있습니다. AMFPHP에서 데이터를 검색하는 동안 팝업 창을 표시하려고합니다. 실행이 완료되면 제거됩니다.AMFPHP에서 데이터를 가져 오는 동안 팝업 창 표시

<?xml version="1.0" encoding="utf-8"?> 
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
      xmlns:s="library://ns.adobe.com/flex/spark" 
      xmlns:mx="library://ns.adobe.com/flex/mx" 
      width="615" height="350" minWidth="955" minHeight="600"> 
<fx:Script> 
    <![CDATA[ 
     import mx.controls.Alert; 
     import mx.rpc.events.ResultEvent; 
     import mx.utils.ArrayUtil; 

     protected function button1_clickHandler(event:MouseEvent):void 
     { 
      //i want to show popwindow for slow process 
      amf.readProduct(); 
     } 
     protected function method1_resultHandler(event:ResultEvent):void 
     { 
      //Here the data is retrieved successfully then the popup is removed 
      myArraydata.removeAll(); 
      myArraydata = new ArrayCollection(ArrayUtil.toArray(event.result)); 
     } 

    ]]> 
</fx:Script> 
<fx:Declarations> 
    <!-- Place non-visual elements (e.g., services, value objects) here --> 
    <s:RemoteObject id="amf" source="your_source" destination="your_amf_destination" 
        endpoint="your_services" fault="{Alert.show(event.fault.faultDetail);}" showBusyCursor="true"> 
     <s:method name="readProduct" result="method1_resultHandler(event)"/> 

    </s:RemoteObject> 
    <s:ArrayCollection id="myArraydata"/> 
</fx:Declarations> 
<s:Button x="10" y="10" label="Retrieve Data" click="button1_clickHandler(event)"/> 
<mx:AdvancedDataGrid id="adg1" x="10" y="39" width="595" height="301" designViewDataType="flat"> 
    <mx:columns> 
     <mx:AdvancedDataGridColumn dataField="col1" headerText="Column 1"/> 
     <mx:AdvancedDataGridColumn dataField="col2" headerText="Column 2"/> 
     <mx:AdvancedDataGridColumn dataField="col3" headerText="Column 3"/> 
    </mx:columns> 
</mx:AdvancedDataGrid> 
</s:Application> 

답변

1

또 다른 방법은 readProduct 호출을 시작하기 전에 새 팝업 인스턴스를 만들고 해당 함수를 재실행하고 거기에 저장하는 AsyncToken을 사용하는 것입니다. 그런 다음 결과 핸들러에서 ResultEvent.token 오브젝트에서 해당 인스턴스를 가져 와서 해당 인스턴스 만 닫을 수 있습니다.

protected function button1_clickHandler(event:MouseEvent):void 
    { 
     var popup:IFlexDisplayObject = PopUpManager.createPopup(this, MyPopupComonent, true); 
     //i want to show popwindow for slow process 
     var token:AsyncToken = amf.readProduct(); 
     token.popup = popup; 

    } 
    protected function method1_resultHandler(event:ResultEvent):void 
    { 
     var popup:IFlexDisplayObject = IFlexDisplayObject(event.token.popup); 
     PopUpManager.removePopup(popup); 

     //Here the data is retrieved successfully then the popup is removed 
     myArraydata.removeAll(); 
     myArraydata = new ArrayCollection(ArrayUtil.toArray(event.result)); 
    } 
+0

내 문제를 해결해 주셔서 감사합니다. –

1

간단한 아이디어는 팝업에서 진행 표시 줄 & 부하를 생성하는 것입니다 (그것은 .... 로딩처럼도 메시지를 취할 수 있습니다.) 버튼을 클릭하면 팝업을 생성 한 다음 값을 바인딩 할 때 removeallPopups();