I have a custom HTTP service, in this service I have done overridden
the dispatchEvent method to enable us to check for and handle any
debug data contained in the HTTP response (as we're using CakePHP on
the backend).

What I'm doing is the following:

override public function dispatchEvent(event:Event):Boolean
{                                               
        var theEvent:Event = event;
                        
        if( event.type == ResultEvent.RESULT ) {
                theEvent = this.handleCakeResponse( event as ResultEvent );     
        }

        return super.dispatchEvent( theEvent );
}

This all works fine, except from when there is a FaultEvent being
dispatched, I get the following error:

TypeError: Error #1034: Type Coercion failed: cannot convert
mx.rpc.events::[EMAIL PROTECTED] to mx.rpc.events.ResultEvent.
        at
flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
        at flash.events::EventDispatcher/dispatchEvent()
        at
com.test.rpc.http::CakeHTTPService/dispatchEvent()[F:\Work\app\com\test\rpc\http\CakeHTTPService.as:63]
        at
mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent()[E:\dev\flex_201_borneo\sdk\frameworks\mx\rpc\AbstractInvoker.as:146]
        at
mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::faultHandler()[E:\dev\flex_201_borneo\sdk\frameworks\mx\rpc\AbstractInvoker.as:195]
        at
mx.rpc::Responder/fault()[E:\dev\flex_201_borneo\sdk\frameworks\mx\rpc\Responder.as:56]
        at
mx.rpc::AsyncRequest/fault()[E:\dev\flex_201_borneo\sdk\frameworks\mx\rpc\AsyncRequest.as:110]
        at
DirectHTTPChannel.as$131::DirectHTTPMessageResponder/securityErrorHandler()[E:\dev\flex_201_borneo\sdk\frameworks\mx\messaging\channels\DirectHTTPChannel.as:368]
        at
flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
        at flash.events::EventDispatcher/dispatchEvent()
        at flash.net::URLLoader/flash.net:URLLoader::redirectEvent()

Note the line 63 in the stack trace refers to the "return
super.dispatchEvent( theEvent );" line.

I'm really stuck with this, and now I can't debug an issue that is
occurring as it is trying to dispatch a fault event, which it won't.
Also as the HTTPService isn't released as part of the source code I'm
working blind here so any help would be greatly appreciated.

-D

Reply via email to