我要建在Adobe Flash CS 5的AIR应用程序,我需要检查,如果互联网连接可用。
I'm building an Air app with Adobe Flash CS 5. I need to check if an internet connection is available.
我遇到这个错误:
1172:定义air.net找不到。 1046:类型未发现的或没有编译时间常数:URLMonitor
1172: Definition air.net could not be found. 1046: Type was not found or was not a compile-time constant: URLMonitor.
这是我的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
您需要添加aircore.swc
You need to add the aircore.swc
转到文件 - >动作设置
Go to File->ActionScript Settings
在库路径选项卡上,单击+图标(添加新路径),然后单击闪存图标(浏览到SWC)。
On the Library Path tab, click the + icon (Add New Path) and then click the Flash icon (Browse To SWC).
然后,您需要浏览至安装了Flash CS5的位置,去AIK2.5 /框架/库/空气/并选择aircore.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