Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/apache-flex/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Flash 从AMFPHP检索数据时显示弹出窗口_Flash_Apache Flex_Flash Builder_Amfphp - Fatal编程技术网

Flash 从AMFPHP检索数据时显示弹出窗口

Flash 从AMFPHP检索数据时显示弹出窗口,flash,apache-flex,flash-builder,amfphp,Flash,Apache Flex,Flash Builder,Amfphp,您好,我正在使用Flash Builder 4.6创建应用程序,并使用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" x

您好,我正在使用Flash Builder 4.6创建应用程序,并使用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>


简单的方法是创建一个进度条并将其加载到弹出窗口中(它可以接收与加载类似的消息)。单击按钮创建弹出窗口,然后在绑定值时使用removeallPopups()

另一种方法是在开始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));
    }

非常感谢你解决了我的问题。