flex-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robert_dodier <robert.dod...@gmail.com>
Subject How to prevent default pop-up behavior for a mx.rpc fault event
Date Thu, 02 Apr 2015 00:58:51 GMT
Hi, 

As a continuation of my previous message, I've made some progress. I have
installed an event listener for fault events on a service and the event
handler writes a message to the console log, which I can inspect in Firebug.
When there are errors (which I can trigger by disabling wifi), I see the
events written to the Firebug console. So far, so good. However, I also want
to suppress the default behavior, which is to open a pop-up window with the
message "Send failed". I've tried various things to prevent the pop-up from
being called:

 * call event.preventDefault within the event handler
 * call event.stopImmediatePropagation in the event handler
 * set priority = 9999 in addEventListener
 * add two handlers in addEventListener, one with useCapture = true and one
with useCapture = false

For the record, here is an example of a fault event which is logged to the
Firebug console:

    MyController: my service fault; event=[FaultEvent fault=[RPC Fault
faultString="Send failed" faultCode="Client.Error.MessageSend"
faultDetail="Channel.Connect.Failed error NetConnection.Call.Failed: HTTP:
Failed: url: 'http://foo.com/messagebroker/amf'"]
messageId="9D1657B2-0B83-7B85-84E1-779A94D45FDF" type="fault" bubbles=false
cancelable=true eventPhase=2]

Can anyone think of something else to try? Thanks in advance for any ideas.

best,

Robert Dodier

PS. For reference, here is the code I have so far:

    import MyController;
    import flash.external.ExternalInterface;
    import mx.rpc.events.FaultEvent;

    private function log(msg:String):void {
        ExternalInterface.call("console.log", msg);
    }   
        
    private function logCreationComplete():void {
        log("MyController: creation complete.");
        MyController.services.myService.addEventListener(FaultEvent.FAULT,
myServiceFaultLogger, false, 9999);
        MyController.services.myService.addEventListener(FaultEvent.FAULT,
myServiceFaultLogger, true, 9999);
    }   
            
    protected function myServiceFaultLogger(event:FaultEvent):void
    {
        log("MyController: my service fault; event=" + event);
        event.stopImmediatePropagation();
        event.preventDefault();
    }




--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/How-to-prevent-default-pop-up-behavior-for-a-mx-rpc-fault-event-tp9981.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Mime
View raw message