Flex - Is there a way to change the “Channel Disconnected” error message?

强颜欢笑 提交于 2019-12-11 11:53:35

问题


I have a Flash app with a PHP backend. Whenever there is a PHP error, I get the "Channel Disconnected before an acknowledgement was received" error message.

I'm getting ready to push my project to beta and I would prefer if this message said something more like "There was a PHP error, please log a bug" or something instead of a message they don't understand.

Anyone know of a way for me to change this error message? BTW I'm pretty much a noob when it comes to Flash programming so please be descriptive. Using Flash Builder 4 Beta 2.


回答1:


Just figured it out. In the declaration of my PHP service, there is a parameter called "fault", which is set the following by default:

fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)"

This is where we can change the message to whatever we want, by changing the message that is alerted.




回答2:


You should also be able to setup a fault handler in your flex app remote object. That way, you can actually report the problem automatically (inside "onFault").

<mx:RemoteObject id="ro" destination="AMFServer">
  <mx:method name="getSomething" fault="onFault(event)" 
        result = "onResult(event)" />
</mx:RemoteObject>


来源:https://stackoverflow.com/questions/2519762/flex-is-there-a-way-to-change-the-channel-disconnected-error-message

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!