使用Flex來開發air應用,如果想使用最新sdk的話,配置起來還真是一個麻煩事兒。
Flex捐給apache維護了,air還是adobe自己維護,那么就得分別到這兩邊下載最新的sdk然后自己整合起來(apache貌似提供了這么一個工具Flex Sdk installer,因為國情以及可能本工具自身也有bug,一直下載github.com/swfobject/swfobject/archive失敗,經查此頁面404,我一直沒有安裝成功過)
步驟如下:
1. 下載Flex sdk : http://flex.apache.org/download-binaries.html
2. 下載Air sdk : http://www.adobe.com/devnet/air/air-sdk-download.html 注:air要下下面方框里面那個版本,那才是給Flex用戶使用的。
3. 解壓Flex sdk到Flex_air(自己隨意)下,然后解壓Air sdk,覆蓋到Flex_air目錄下。
如果此時直接導入fb使用的話,可能報出{airHome}和{playerglobalHome}的錯誤,那是因為一些相關參數沒有進行正確配置,請繼續進行如下幾個步驟
4. 進入frameworks目錄,找到如下三個文件:air-config.xml(air配置文件),airmobile-config.xml(air手機應用配置文件),flex-config.xml(flex配置文件)
5. 修改
<!-- Specifies the minimum player version that will run the compiled SWF. --> <target-player>16.0</target-player> <!-- Specifies the version of the compiled SWF --> <swf-version>27</swf-version>
為自己下載的版本(我這里是air16.0.0)
6. 修改
<!-- List of SWC files or directories to compile against but to omit from --> <!-- linking. --> <external-library-path> <path-element>libs/player/{targetPlayerMajorVersion}.{targetPlayerMinorVersion}/playerglobal.swc</path-element> </external-library-path>
<!-- List of SWC files or directories that contain SWC files. --> <library-path> <path-element>libs</path-element> <path-element>libs/mx</path-element> <path-element>locale/{locale}</path-element> <path-element>libs/player/{targetPlayerMajorVersion}.{targetPlayerMinorVersion}</path-element> </library-path>
這兩處,此處是相對路徑,相對目錄是X:/Flex_air/frameworks/,自己根據實際情況修正一下每個url是不是正確,我這是已經修改好的flex_config.xml
OK,現在大功告成,導入fb開始使用吧!
本文參考了zengrong兄的文章:http://zengrong.net/post/1848.htm
轉載請注明出處 http://www.cnblogs.com/DarkMaster/p/4200020.html
有問題歡迎郵件交流sky-wang@qq.com