顯示具有 ActionScript 標籤的文章。 顯示所有文章
顯示具有 ActionScript 標籤的文章。 顯示所有文章

Actionscript 4.0 新特性預覽

Actionscript 4.0 新特性預覽

Colin Moock發表了一份ECMAScript 4.0的最新特性而AS3還不支援的匯總說明。因為AS是基於ECMAScript的,所以將來的AS4理論上應該會支援ECMAScript 4.0的這些新特性,至少會部分支援。

這些新特性包括:

1.Record Type:記錄類型

它可以快速定義一個對象的元素類型,比定義一個類更簡潔。如AS3中有Point類,如果我們只需要一個簡單的對象來記錄一些點的坐標,用Point類別就浪費了。於是我們就可以用type關鍵字來建立記錄類型:type Point={x:Number,y:Number},這樣我們就可以用new Point(10,20)來定義一個點了。它比AS3中的Point類輕巧而快速,而且是強類型,比如new Point("riaidea","true")就會錯誤。

2.Array Type:數組類型

同記錄類型類似,它可以讓你定義一個數組對象的元素類型。比如:type myArray=[int,String],那麼第一個元素就只能是int類型,第二元素只能是String類型。

3.Union Types:復合類型

它能指定一個變數為多個類型。如:var content:(StringXML),其中變數content可以為String或XML類型。在方法中的參數定義也可以用復合類型。

4.Generic Functions:重載方法

很多朋友都問為什麼AS3沒有重載,AS4就會應該有了。

5.Iterators and Generators:迭代器和控制器。與python相似。

6.New Number Types:新資料類型。

新增byte, double, decimal,而Number類型則會取消。

更詳細的請看Moock的文章:
http://moock.org/lectures/newInECMAScript4/

還有ECMAScript4的新標準:
http://www.ecmascript.org/es4/spec/overview.pdf

或這裡ActionScript討論區
或 這篇 ActionScript 3:overview + 翻譯

Flash Professional 9 ActionScript 3.0

Flash Professional 9 ActionScript 3.0

可以更新現有的 Flash Pro 8成為支援 AS 3.0 的更新程式喔
下載位置:http://www.adobe.com/cfusion/entitlement/index.cfm?e=labs%5Fflpro9%5Fas3&loc=en_us(WinXP適用,需登入)
內建最佳化處理過的Virtual MachineXML的處理有變快ActionScript Virtual Machine (AVM2) 支援 ActionScript 3.0
相關 ActionScript 3.0 說明:http://labs.adobe.com/technologies/flash9as3preview/
ActionScript 3.0 Overview http://www.adobe.com/devnet/actionscript/articles/actionscript3_overview.html
ActionScript 3.0資源http://www.adobe.com/devnet/actionscript/
Flash Professional 9 ActionScript 3.0 Preview消息發佈:http://labs.adobe.com/technologies/flash9as3preview/
Flash Professional 9 ActionScript 3.0 Preview下載地址:http://www.adobe.com/go/labs_flash9as3preview_downloads (107M)
http://www.adobe.com/devnet/flash/articles/flash9_as3_preview.html
使用的詳細範例:http://www.adobe.com/devnet/flash/articles/flash9_as3_preview_05.html
Adoebe 下載 Flash Player 已更新為 9.0 http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash