沒有新回應!
2006-09-20 09:11 AS2與AS3的語法比較表
在討論區看到有人 po 出官方 livedocs 的 AS2 與 AS3 的比較:
http://livedocs.macromedia.com/flex/2/langref/migration.html
我看到幾個項目,讓我覺得該寫這篇分享
| eval() | Removed |
| removeMovieClip() | Removed | Set all references to a movie clip to null to make the movie clip eligible for garbage collection. |
| setProperty() | Removed | To set the value of a writable property, use the dot (.) operator. |
| targetPath() | Removed |
| tellTarget() | Removed | Use the dot (.) operator or the with statement instead. |
| _level | Removed | The concept of levels does not exist in ActionScript 3.0, which instead provides direct access to the display list. See the flash.display package for details. |
| loadBitmap() Method | Removed |
像是 eval 與 tellTarget 與 setProperty 這種 flash 4 的產物,其實早就已經不被建議使用了,不過因為在 flash 4 時代有許多免費的資源還被流傳中,所以還有許多範例有看到這些語法,以後到了 AS3 的時候,若是還習慣這些舊語法的人就會粉不習慣了。
_level 我從來不太使用他,沒啥原因,只因為這個觀念與其他東西有點混亂,初學者有時候不太能理解到底這個指的是設計階段的 Layer 還是 depth,所以我從開始學 flash 4 的時候,就都是使用 mc,而不用 _level。
還有一些 Flash 8 才看到的東西,像是 loadBitmap,這個竟然在 AS3 也被移除了,真有意思。
在該網址的列表中,還有許多項目,有興趣的朋友自己去瀏覽一下吧!
不過,AS3 現在還只是用於 Flex 2,未來 Flash 9 是否也會採用像 AS3 一樣的語法就不知道了,畢竟有些觀念或許在 Flex 2 上面沒有,但是在 Flash 9 上面仍會使用。漸漸地,Flash 與 Flex 可能會有各自的 ActionScript 吧!亂猜的!



