AS3检查网络链接是否正常,这段代码通过监控一个指定的url来判断链接是否正常
import air.net.URLMonitor; import flash.net.URLRequest; import flash.events.StatusEvent; var monitor:URLMonitor = new URLMonitor(new URLRequest(‘http://www.75271.com’)); monitor.addEventListener(StatusEvent.STATUS, checkHTTP); monitor.start(); function checkHTTP(e:StatusEvent) { if (monitor.available) { test_txt.text ="Internet is available"; } else { test_txt.text ="No internet connection available"; } }