Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/65.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Actionscript 自动更新AIR应用程序_Actionscript_Flex4 - Fatal编程技术网

Actionscript 自动更新AIR应用程序

Actionscript 自动更新AIR应用程序,actionscript,flex4,Actionscript,Flex4,我正在学习AIR应用程序的自动更新功能。我创建了一个不工作的简单应用程序。代码如下: AutoUpdate.mxml *最初在AutoUpdate-app.xml和update.xml文件中,版本标记设置为1.0.0 *服务器端update.xml文件为: 1.0.0 http://localhost:8081/DynamicWeb/release/Update_air.air 1) 跟踪update.xml中的真实版本,并确保操作正确。您必须确保运行1.0.0版本的旧应用程序。顺便说一

我正在学习AIR应用程序的自动更新功能。我创建了一个不工作的简单应用程序。代码如下:

AutoUpdate.mxml


*最初在AutoUpdate-app.xml和update.xml文件中,版本标记设置为1.0.0

*服务器端update.xml文件为:

1.0.0
http://localhost:8081/DynamicWeb/release/Update_air.air
1) 跟踪update.xml中的真实版本,并确保操作正确。您必须确保运行1.0.0版本的旧应用程序。顺便说一句,您可以使用属性
ApplicationUpdateUI.currentVersion
而不是
NativeApplication.NativeApplication.applicationDescriptor

2) 调用checkNow()后,您不会侦听事件。收听所有事件,如本文所述。在

(请参见UpdateManager.as#initialize()):


可能,您遗漏了一些内容…

在服务器端update.xml中,您应该将标签version替换为versionNumber
自从AIR 2.5以来,情况发生了变化。

当我监听这些事件时,我得到了updateError(ErrorEvent.ERROR)。但我不知道到底是哪里的错?有人能告诉我如何找到bug吗?在flashbuilder event.message中跟踪或调试
<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 
                   xmlns:s="library://ns.adobe.com/flex/spark" 
                   xmlns:mx="library://ns.adobe.com/flex/mx" 
                   creationComplete="checkForUpdate()" >
<fx:Script><![CDATA[
    import air.update.ApplicationUpdaterUI;
    import air.update.events.UpdateEvent;

    private var appUpdater:ApplicationUpdaterUI=new ApplicationUpdaterUI();

    private function checkForUpdate():void
    {
        setApplicationVersion(); 
        appUpdater.delay = 1;
        appUpdater.isDownloadProgressVisible = true;
        appUpdater.isDownloadUpdateVisible = true

        appUpdater.isInstallUpdateVisible = true;
        appUpdater.isFileUpdateVisible = true;

        appUpdater.updateURL = "http://localhost:8081/DynamicWeb/release/update.xml";           
        appUpdater.isCheckForUpdateVisible = false; 
        appUpdater.addEventListener(UpdateEvent.INITIALIZED, onUpdate);
        appUpdater.addEventListener(ErrorEvent.ERROR, onError);
        appUpdater.initialize();
                   } 
    }

    // Find the current version for our Label below
    private function setApplicationVersion():void
    {
        var appXML:XML = NativeApplication.nativeApplication.applicationDescriptor;
        var ns:Namespace = appXML.namespace();
        lbl.text = "Current version is " + appXML.ns::version;
        //Common.helpDetails = appXML.ns::versionLabel;

    }

    private function onError(event:ErrorEvent):void
    {
        //Alert.show(event.toString());
    }

    private function onUpdate(event:UpdateEvent):void
    {
        appUpdater.checkNow(); // Go check for an update now         } 
    }

]]></fx:Script>


<s:HGroup x="89" y="124" width="413" height="34">
    <s:Label id="lbl" />
</s:HGroup>

</s:WindowedApplication>
<?xml version="1.0" encoding="UTF-8"?>
<update xmlns="http://ns.adobe.com/air/framework/update/description/1.0">
<version>1.0.0</version>
<url>http://localhost:8081/DynamicWeb/release/Update_air.air</url>
<description><![CDATA[
 Typically, this is used to summarize what's new in the release
 ]]></description>
</update>
appUpdater.addEventListener(UpdateEvent.INITIALIZED, updaterEvent);
appUpdater.addEventListener(StatusUpdateEvent.UPDATE_STATUS, updaterEvent);
appUpdater.addEventListener(UpdateEvent.BEFORE_INSTALL, updaterEvent);
appUpdater.addEventListener(StatusUpdateErrorEvent.UPDATE_ERROR, updaterEvent);
appUpdater.addEventListener(UpdateEvent.DOWNLOAD_START, updaterEvent);
appUpdater.addEventListener(ProgressEvent.PROGRESS, updaterEvent);
appUpdater.addEventListener(UpdateEvent.DOWNLOAD_COMPLETE, updaterEvent);
appUpdater.addEventListener(DownloadErrorEvent.DOWNLOAD_ERROR, updaterEvent);
appUpdater.addEventListener(ErrorEvent.ERROR, updaterEvent);

private function updaterEvent(event : Event) : void {
    trace(event.type);
}