Flex Mobile開發入門
一、概述
Adobe AIR(Adobe Integrated Runtime),一個跨操作系統的運行時。恩,跨平臺的解決方案,和Java虛擬機一樣。
所以呢,運行這些軟件,要先裝個AIR。好像,QQ農場什麼的就需要這個。
Flex,軟件開發框架,開發出的軟件即在AIR上運行。支持了Mobile,建工程時有Apple、BlackBerry、Android三平臺。
>>Adobe Developer Connection(Adobe 開發者中心)
二、環境
下個Adobe Flash Builder,安裝下即可!當前是4.6版本。
>>下載地址
>>額外參考
>>Adobe Flash Builder 4.6參考
三、Android Flex
簡單得找了本入門書籍《Developing Android Applications with Flex 4.5》,先大概學習看看^^。其中文版下載:http://ishare.iask.sina.com.cn/f/22644465.html。就80頁,很快的。
附件爲該書工程,主要被整理在AndroidFlexSamples。如下:
其他的,可以看如下的文檔:
>>使用ADOBE FLEX和ADOBE FLASH BUILDER開發手機應用程序
官方的,很詳細。包括了基礎控件、設計什麼的。
>> Flex Mobile in Action
新出沒多久的書,看了下目錄,好像挺不錯的。
四、AS、mxml什麼的
還沒系統瞭解過呢,大概就下面這個樣子的:
>>AndroidFlexSamples.mxml
- <?xml version="1.0" encoding="utf-8"?>
- <s:ViewNavigatorApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
- xmlns:s="library://ns.adobe.com/flex/spark"
- applicationComplete="appCompleteHandler(event)" applicationDPI="240"
- firstView="views.HomeView"
- splashScreenImage="@Embed('assets/android_icon.jpg')"
- splashScreenMinimumDisplayTime="3000" splashScreenScaleMode="letterbox">
- <fx:Script>
- <![CDATA[
- import mx.events.FlexEvent;
- import mx.formatters.DateFormatter;
- /** 日期格式化對象 */
- protected var df:DateFormatter;
- /** 返回事件監聽者 */
- private var onBackListener:OnBackListener;
- /** 應用初始化處理 */
- protected function appCompleteHandler(event:FlexEvent):void
- {
- // 初始化日期格式化對象
- df = new DateFormatter();
- df.formatString = "HH:NN:SS";
- // 註冊鍵盤事件
- stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyboardHanlder);
- }
- /** 鍵盤鍵點擊 */
- private function onKeyboardHanlder(event:KeyboardEvent):void
- {
- if(event.keyCode == Keyboard.BACK) { // BACK鍵
- backHandler();
- }
- }
- /** Home鍵點擊處理 */
- protected function homeBtn_clickHandler(event:MouseEvent):void
- {
- navigator.popToFirstView();
- }
- /** Back按鈕點擊 */
- protected function backBtn_clickHandler(event:MouseEvent):void
- {
- backHandler();
- }
- /** 返回處理 */
- private function backHandler():void
- {
- if (navigator.length > 1) {
- if (onBackListener != null) {
- onBackListener.onBackHandler();
- }
- navigator.popView();
- } else {
- NativeApplication.nativeApplication.exit();
- }
- }
- /** 格式化時間 */
- public function formatTime():String
- {
- return df.format(new Date());
- }
- /** 設置返回事件監聽者 */
- public function setOnBackListener(onBackListener:OnBackListener):void
- {
- this.onBackListener = onBackListener;
- }
- ]]>
- </fx:Script>
- <fx:Declarations>
- <!-- Place non-visual elements (e.g., services, value objects) here -->
- </fx:Declarations>
- <s:navigationContent>
- <s:Button id="homeBtn" label="Home" click="homeBtn_clickHandler(event)"/>
- </s:navigationContent>
- <s:actionContent>
- <s:Button id="backBtn" label="Back" click="backBtn_clickHandler(event)"/>
- </s:actionContent>
- </s:ViewNavigatorApplication>
ActionScript可以看如下手冊學習:
>>FlashCS3簡體中文幫助文檔
http://ishare.iask.sina.com.cn/f/23955540.html(重新搜的,看大小應該是這個)
五、後記
這些看完,基礎也就差不多了吧^^。恩,官方中英文檔很多,遇到什麼其他的可以去哪裏看。