最基础且最全面的资料,见sdk(现为flex3beta3 sdk)
DEV:
除了少许的变化外,允许我们用已有的flex知识开发air应用,文章推荐
build app from same codebaseAutoUpdater:
当前beta3下的air还不能支持远程module的加载,
算是一个的bug吧,也就否定了将应用内容写成module仅仅deploy在server端的方便升级方式,或许会在其正式发布时支持吧,现如今就只能考虑让air app自己update的使用方式了,
关于AIR runtime的升级一个UpdateManager类,常规的升级方式,server维护一份version的文本文件(如xml)
更高级点的Updater | ,自动下载解压*.air中的application.xml获取版本信息,用以决定是否需要更新,如此则不需要单独维护一份version.xml,站点上代码暂未beta2的代码,少许更改既可用于beta3

AIRRemoteUpdater for beta3
1
/**//*
2
* Copyright (C) 2007 Claus Wahlers
3
*
4
* This software is provided 'as-is', without any express or implied
5
* warranty. In no event will the authors be held liable for any damages
6
* arising from the use of this software.
7
*
8
* Permission is granted to anyone to use this software for any purpose,
9
* including commercial applications, and to alter it and redistribute it
10
* freely, subject to the following restrictions:
11
*
12
* 1. The origin of this software must not be misrepresented; you must not
13
* claim that you wrote the original software. If you use this software
14
* in a product, an acknowledgment in the product documentation would be
15
* appreciated but is not required.
16
* 2. Altered source versions must be plainly marked as such, and must not be
17
* misrepresented as being the original software.
18
* 3. This notice may not be removed or altered from any source distribution.
19
*/
20
21
package com.codeazur.utils
22

{
23
import com.codeazur.fzip.*;
24
25
import flash.desktop.NativeApplication;
26
import flash.desktop.Updater;
27
import flash.events.*;
28
import flash.filesystem.File;
29
import flash.filesystem.FileMode;
30
import flash.filesystem.FileStream;
31
import flash.net.*;
32
import flash.utils.*;
33
34
public class AIRRemoteUpdater extends EventDispatcher
35
{
36
protected static var pathAppXml:Array = ["META-INF", "AIR", "application.xml"];
37
38
protected var _localVersion:String = "";
39
protected var _remoteVersion:String = "";
40
protected var _request:URLRequest;
41
42
public function AIRRemoteUpdater()
43
{
44
}
45
public function update(request:URLRequest, versionCheck:Boolean = true):void
{
46
_request = request;
47
if(!versionCheck)
{
48
forceUpdate();
49
} else
{
50
_localVersion = getLocalVersion();
51
var air:FZip = new FZip();
52
air.addEventListener(FZipEvent.FILE_LOADED, zipFileLoadedHandler);
53
air.addEventListener(IOErrorEvent.IO_ERROR, defaultHandler);
54
air.addEventListener(SecurityErrorEvent.SECURITY_ERROR, defaultHandler);
55
air.load(request);
56
}
57
}
58
59
public function get localVersion():String
{
60
return _localVersion;
61
}
62
63
public function get remoteVersion():String
{
64
return _remoteVersion;
65
}
66
67
protected function zipFileLoadedHandler(e:FZipEvent):void
{
68
if(e.file.filename == pathAppXml.join("/"))
{
69
FZip(e.target).close();
70
var content:String = e.file.getContentAsString();
71
var desciptor:XML=new XML(content);
72
var ns:Namespace=desciptor.namespace();
73
_remoteVersion = new XML(content).ns::version;
74
var versionMatch:int = compareVersions();
75
if(dispatchEvent(new AIRRemoteUpdaterEvent(AIRRemoteUpdaterEvent.VERSION_CHECK)))
{
76
if(versionMatch > 0)
{
77
forceUpdate();
78
}
79
}
80
}
81
}
82
83
protected function forceUpdate():void
{
84
var loader:URLLoader = new URLLoader();
85
loader.dataFormat = URLLoaderDataFormat.BINARY;
86
loader.addEventListener(Event.COMPLETE, fileCompleteHandler);
87
loader.addEventListener(IOErrorEvent.IO_ERROR, defaultHandler);
88
loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, defaultHandler);
89
loader.addEventListener(Event.OPEN, defaultHandler);
90
loader.addEventListener(ProgressEvent.PROGRESS, defaultHandler);
91
loader.addEventListener(HTTPStatusEvent.HTTP_STATUS, defaultHandler);
92
loader.load(_request);
93
}
94
95
protected function fileCompleteHandler(e:Event):void
{
96
var file:File = File.createTempFile();
97
var stream:FileStream = new FileStream();
98
var data:ByteArray = URLLoader(e.target).data as ByteArray;
99
stream.open(file, FileMode.WRITE);
100
stream.writeBytes(data);
101
stream.close();
102
if(dispatchEvent(new AIRRemoteUpdaterEvent(AIRRemoteUpdaterEvent.UPDATE, file)))
{
103
var updater:Updater = new Updater();
104
updater.update(file, _remoteVersion);
105
}
106
}
107
108
protected function defaultHandler(e:Event):void
{
109
dispatchEvent(e.clone());
110
}
111
112
protected function getLocalVersion():String
{
113
var descriptor:XML=NativeApplication.nativeApplication.applicationDescriptor;
114
var ns:Namespace=descriptor.namespace();
115
return descriptor.ns::version;
116
}
117
118
protected function compareVersions():int
{
119
var rv:Number = parseFloat(_remoteVersion);
120
var lv:Number = parseFloat(_localVersion);
121
if(rv > lv)
{
122
return 1;
123
} else if(rv < lv)
{
124
return -1;
125
} else
{
126
return 0;
127
}
128
}
129
}
130
}
131
CodeApollo,可以搜到许多问题答案或是提问的地方
Distribute:
basically deploy with badge,see sdk
badge with swfobjectdeploy occurred some error,
check it,or you may be
use the logbeta3中的部署(通过badge)有一点即flashvar中的appurl为
绝对地址非相对地址等等
Resouces:
Flex/AIR TourAdobe AIR ForumApolloCoders MaillistMXNA AIRFullasagoog air channel开始写代码赚money吧!!