AS
private function checkForUpdate():void
{
var appUpdater:ApplicationUpdaterUI = new ApplicationUpdaterUI();
appUpdater.updateURL = "http://localhost:8080/test_update.xml";
appUpdater.isCheckForUpdateVisible = false; // 是否提示检查更新
appUpdater.addEventListener(UpdateEvent.INITIALIZED, onUpdate);
appUpdater.addEventListener(ErrorEvent.ERROR, onError);
appUpdater.initialize();
}
private function onError(event:ErrorEvent):void
{
}
private function onUpdate(event:UpdateEvent):void
{
appUpdater.checkNow(); // Go check for an update now
}
test_update.xml
<?xml version="1.0" encoding="utf-8"?>
<!-- update.xml -->
<update xmlns="http://ns.adobe.com/air/framework/update/description/1.0">
<versionNumber>3.0</versionNumber>
<url>http://localhost:8080/Main.air</url>
<description>
<text xml:lang="en_US">AIR AutoUpdate</text>
<text xml:lang="zh_CN">AIR 自动更新</text>
</description>
</update>
转载:http://hi.baidu.com/yaoguozhen/item/a74b5a205fd527d5a417b600
参考:http://www.wiui.net/?p=341
注意:
1. test_update.xml必须保存成utf-8编码的。否则中文会显示出乱码。
2. 如果在ADL中看到报错[ErrorEvent type="error" bubbles=false cancelable=false eventPhase=2 text="Cannot update (from remote)" errorID=16828] ;请使用发行版本来测试,调试版本不支持升级安装。
本文介绍了一种Adobe AIR应用程序的自动更新实现方法,通过自定义函数检查更新,并配置test_update.xml文件来指引更新流程。文章提供了具体的ActionScript代码示例及注意事项。
404

被折叠的 条评论
为什么被折叠?



