I’m building an Air app with Adobe Flash CS 5. I need to check if an internet connection is available.
I’m running into this errors:
1172: Definition air.net could not be found.
1046: Type was not found or was not a compile-time constant: URLMonitor.
This is my code:
import air.net.*;
var monitor:URLMonitor;
function checkInternetConnection(e:Event = null):void
{
var url:URLRequest = new URLRequest("http://www.google.com");
url.method = "HEAD";
monitor = new URLMonitor(url);
monitor.pollInterval = 3000;
//
monitor.addEventListener(StatusEvent.STATUS,onConnection);
//
function onConnection(e:Event = null):void
{
trace("onConnection")
}
//
monitor.start();
trace(monitor)
}
What is missing?
Thanks.
Uli
You need to add the aircore.swc
Go to File->ActionScript Settings
On the Library Path tab, click the + icon (Add New Path) and then click the Flash icon (Browse To SWC).
You then need to browse to the location where Flash CS5 is installed and go to AIK2.5/frameworks/libs/air/ and select the aircore.swc