Flex捕获异常问题
internal function initApp():void
{
//执行连接,向服务端的ServiceSocket的8888端口发送连接请求,服务端就会分配一个端口给客户端使用
socket.connect("192.168.0.60",8888);
//监听连接成功事件
socket.addEventListener(Event.CONNECT,funConnect);
//监听关闭事件
socket.addEventListener(Event.CLOSE,funClose);
//监听服务器新信息,接收服务端发送的信息
socket.addEventListener(ProgressEvent.SOCKET_DATA,funSocket);
}
这是一段Flex Socket代码
现在出现的问题是如果程序运行的机器上网线没有插
运行这段代码的时候Flesh Debug会弹出异常窗口。
这个异常我该如何捕获并进行友好提示(比如用alert.show来提示信息)? 望高手赐教
socket.addEventListener(IOErrorEvent.IO_ERROR, funIOError);
socket.addEventListener(SecurityErrorEvent.SECURITY_ERROR, funError);
private function funError(e:SecurityErrorEvent):void
{
Alert.show(e.text);
}
private function funError(e:SecurityErrorEvent):void
{
相关问答:
如果有数据源如下:
<root>
<type label="Food" name="li">
<food label=" ......
现在要求用flex写一个注册控件,要求在点击注册按钮的时候,把上述注册信息以XML数据格式比如说 <componentname>用户名: </componentname> <componentcontent>张三 </componentcontent>的 ......
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" fontSize="12" creatio ......
我现在利用flex和ASP.net建立一个小型的管理系统,下面代码目的是在asp。net中建立一个数据库的查询函数,然后在flex端调用,并绑定到DATAGIRD中,但是就不通,请各位大侠帮忙。
public object viewFriendInfo() ......