开发者

How can I show Success Message from Backend and display in flex frontend?

开发者 https://www.devze.com 2023-02-27 01:34 出处:网络
How do I show a suc开发者_开发技巧cess message in frontend after a record is inserted into the backend.

How do I show a suc开发者_开发技巧cess message in frontend after a record is inserted into the backend. I amm using FLEX as front end and Toad as Backend.


Assuming the front end made a remote call using either RemoteObject, WebService, or HTTPService, each one of those should dispatch a result event when you get a successful result from the server. I would use the result handler to show the alert.


Use remoteObject as in mxml

<mx:Script>
        <![CDATA[
            import mx.controls.Alert;
            import mx.rpc.events.FaultEvent;
            import mx.rpc.events.ResultEvent;

            private function resultHandler(event:ResultEvent):void
            {
                Alert.show("Back with success");
                Alert.show(event.message.toString());
            }

            private function faultHandler(event:FaultEvent):void
            {
                Alert.show("Back with Error");
                Alert.show(event.message.toString());
            }

        ]]>
    </mx:Script>
    <mx:RemoteObject id="remoteObject" destination="yourdestination"
                            showBusyCursor="true"
                            result="{resultHandler(event)}"
                            fault="{faultHandler( event )}">
    </mx:RemoteObject>

Note:Above Code is in Flex3

Hopes that helps

0

精彩评论

暂无评论...
验证码 换一张
取 消