开发者

how to check internet connection is available or not in flex

can anyone help me, how to check whether internet connectio开发者_如何学运维n is available or not in my flex application.One more scenario is, if network connection is there but some problem in internet connection how to check internet connection is available or not.


There is a good example here: http://livedocs.adobe.com/flex/3/html/help.html?content=network_connectivity_1.html

import air.net.URLMonitor;
import flash.net.URLRequest;
import flash.events.StatusEvent;

var monitor:URLMonitor;
monitor = new URLMonitor(new URLRequest('http://www.adobe.com'));
monitor.addEventListener(StatusEvent.STATUS, announceStatus);
monitor.start();

function announceStatus(e:StatusEvent):void {
    trace("Status change. Current status: " + monitor.available);
}


The answer above works but I would like to add that pointing it to your server directly(if you have one) rather than just Adobe will also allow you to monitor your own server and handle it accordingly.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜