2013-07-21 63 views

回答

0

也許下面的代碼將是有益的:

<?xml version="1.0" encoding="utf-8"?> 
<s:ViewNavigatorApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 
          xmlns:s="library://ns.adobe.com/flex/spark" firstView="views.TestConnectionHomeView" applicationDPI="160" creationComplete="init()"> 
<fx:Script> 
    <![CDATA[ 
     import air.net.URLMonitor; 


     private var monitor:URLMonitor; 

     public function init():void{ 
      monitor = new URLMonitor(new URLRequest('http://www.adobe.com')); 
      monitor.addEventListener(StatusEvent.STATUS, announceStatus); 
      monitor.start(); 
     } 

     public function announceStatus(e:StatusEvent):void { 
      trace("Status change. Current status: " + monitor.available); 
     } 
    ]]> 
</fx:Script> 
</s:ViewNavigatorApplication> 

請訪問以下鏈接Detecting HTTP connectivity了更多的解釋。