Adobe AIR的 - 检查网络连接 [英] Adobe Air - Check for internet connection

查看:594
本文介绍了Adobe AIR的 - 检查网络连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要建在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

这篇关于Adobe AIR的 - 检查网络连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆