前段时间在RIS上发问为什么Adobe只能允许在Flex里开发AIR, 然后得到 Bing 的指引, 学会安装和使用AIRPanel , AIRPanel这个东西是外国开发的, Flash扩展. 原教程是英文版的, 很吃力地去看, 最终还是成功了...... 现在自己写个中文版的, 可能与原文有出入, 但不影响最终实现效果....
原文出处: http://www.gskinner.com/blog/archives/2007/07/creating_air_pr.html
通常你只能在Flex上开发AIR, Adobe 已经表示, 将来的Flash CS版本里会加上AIR支持功能. 但我们现在希望马上就能在Flash里开发AIR怎么办? 那就请看下面的介绍, 先看看AIRPanel的版面, 不错的:
步骤 1: 安装 AIR global SWC
1. 安装 FlexBuilder 3 ("Moxie") beta , 或者从 Adobe Labs 里下载Flex 3 SDK ;
2. 可以在以下其中之一的路径里找到 "airglobal.swc" 文件:
- 在 FlexBuilder 3 安装目录下的"sdks/moxie/frameworks/libs/air/"里, ( 我安装在C盘里, 所以我的默认路径是 C:\Program Files\Adobe\Flex Builder 3\sdks\moxie\frameworks\libs\air );
- 在 " Adobe Flex Builder 3 Plug-in/sdks/moxie/frameworks/libs/air/ " ;
- 在 FlexBuilder 3 "Moxie" SDK "frameworks/libs/air/ " ;
3. 复制 "airglobal.swc" 文件, 并粘贴在 Flash CS3 在安装目录下的 "\en\Configuration\ActionScript 3.0\Classes\ " ( 我是安装在C盘, 所以默认路径是: C:\Program Files\Adobe\Adobe Flash CS3\en\Configuration\ActionScript 3.0\Classes )
PS: 很不幸啊, Flash CS3 里没有 AIR SDk, 只能在 Flex3 里找......
步骤 2: 安装 AIR Panel
1. 安装 Extension Manager v1.8 ;
2. 下载 AIRPanel 压缩包并解压;
3. 为了安装 AIRPanel , 你必须运行 MXP 文件 ( 压缩包里有两个文件夹, 我选用的是AIRPanel文件夹里 );
3. 重启 Flash;
4. 在菜单栏里, 选中 " Window " , 选择" Other Panels > AIRPanel "
注意: 如果你看不到AIRPanel选项, 请确认你用的是 Extension Manager v1.8 , 然后重新安装过 MXP .
步骤 3: 使用AIRpanel
既然现在已经安装了 AIRPanel 和 SWC 了, 那么你可以开始在 Flash CS3 里建立你的AIR了. 现在你可以正常地创作你的AIR, 但是你使用 AIR API 是不会有编译错误的. 注意: 如果你正常在使用AIR API, 你也会收到错误提示的.
在 AIR runtime 里测试:
1. 在那个 AIRPanel 的下拉框里选择你要打开的 fla 文件, 如果你看不到你要找的 fla 文件, 请确定你已经保存了该文件( 还未保存的文件不会出理在下拉项里 );
2. 单击 " Test ";
5. 如果这是你第一次使用 AIRPanel, 你会收到一个提示, 要你选择一个 adl 文件, . 在 Mac 里就选择 "adl " (没有扩展名), 在 Windows 里就选择 "adl.exe" , 这个 adl 文件可以在以下路径之一里找:
- 在 FlexBuilder 3 "Moxie" 安装目录下的 "sdks/moxie/bin/";
- 在 FlexBuilder 3 "Moxie" SDK 下的 "bin/" ;
4. 你的应用程序就会在 AIR Runtime 里编译并打开. 退出并反回Flash CS3里继续编辑.
打包你的 AIR 应用
1. 如上述一样选择你的 fla 文件;
2. 在 AIRPanel 里单击 "Package" 按钮;
3. 如果你还没有指定设置好你的 fla 文件, 你会被提示设置; ( If you have not already specified configuration settings for this FLA, you will be prompted for them. )
4. 如上述, 如果这是你第一次使用这个功能, 你会被提示查找那个 adl 文件;
5. 你的应用程序将被打包为 .air 后缀的文件在同一目录下.
你可以随时更新你的文件配置通过选择 fla , 然后单击 " Setting " 按钮.
=====================
后记(可以一看, 在此不详细说了):
One of the advantages of having this as a panel is that you can test your AIR applications without having to click back to your main FLA (ie. you can do it while editing an asset FLA or a class file).
Troubleshooting
If you have problems, check the following:
- Be sure you are using the correct adl for your system (adl for Mac, adl.exe for Windows), and that it is from the Moxie build of the Flex SDK or FlexBuilder. You can reset this setting by deleting the config.dat file from in your Flash CS3 configuration folder in gskinner/AIRPanel/config.dat
- Check that your SWF is set to export to the same directory as your FLA (we are looking at ways to remove this limitation).
- There may also be an issue with FLAs on network drives.
- Ensure you have the latest java virtual machine. You can download it from java.com
If you are experiencing difficulties on Windows, you can also try using "adl" instead of "adl.exe", just be sure you have the latest JVM installed.
Note that the airglobal.swc and adl files seem to reside in a few different locations. If you can't find one of them in the locations above, do a search for the file, and let us know in the comments below where you find it. If you don't find it, make sure that you have the FlexBuilder 3 beta, or Flex 3 beta SDK installed.
UPDATE: Release 2, July 3 Please use extension manager to remove the previous extension prior to installing this version! Everything should still run ok, but removing the old version in the future may cause problems.
The zip file linked above has been updated with a new build. The most significant updates are the addition of a setting for window mode (system or transparent), and support for XML round-tripping, so edits/additions to the AIR application XML file will be preserved. We've also tweaked the interface, and made some other minor updates.
In a bid to reduce the issues with a jsapi bug and long file paths, we had to put in some messy fixes. Let me know in the comments if you experience any bugs or difficulties.
UPDATE: Release 3, July 4
Fixed a minor bug where the panel would overwrite the app xml file when packaging.
We will likely be releasing additional updates based on feedback, so check back here soon (clicking the "?" icon in the panel will take you back to this post). If you have any feature requests, or encounter any problems, let us know in the comments below.
回复Comments
{commenttime}{commentauthor}
{CommentUrl}
{commentcontent}