

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、<p> 《動(dòng)作腳本》,摘自自維基百科,</p><p><b> 自由的百科全書</b></p><p><b> 2009年5月10</b></p><p> 《ActionScript》</p><p> Designed by Gary Grossman</p>
2、;<p><b> 1998年9月</b></p><p><b> 英文譯文:</b></p><p><b> 動(dòng)作腳本</b></p><p> ActionScript是 Macromedia(現(xiàn)已被Adobe收購(gòu))為其Flash產(chǎn)品開(kāi)發(fā)的,最初是一種簡(jiǎn)單的腳本語(yǔ)言,現(xiàn)在
3、最新版本3.0,是一種完全的面向?qū)ο蟮木幊陶Z(yǔ)言,功能強(qiáng)大,類庫(kù)豐富,語(yǔ)法類似JavaScript,多用于Flash互動(dòng)性、娛樂(lè)性、實(shí)用性開(kāi)發(fā),網(wǎng)頁(yè)制作和RIA應(yīng)用程序開(kāi)發(fā)。</p><p> ActionScript 是一種基于ECMAScript的腳本語(yǔ)言,可用于編寫Adobe Flash動(dòng)畫和應(yīng)用程序。 由于ActionScript和JavaScript都是基于ECMAScript語(yǔ)法的,理論上它們互相可以
4、很流暢地從一種語(yǔ)言翻譯到另一種。不過(guò)JavaScript的文檔對(duì)象模型(DOM)是以瀏覽器窗口,文檔和表單為主的,ActionScript的文檔對(duì)象模型(DOM)則以SWF格式動(dòng)畫為主,可包括動(dòng)畫,音頻,文字和事件處理。</p><p><b> 歷史 </b></p><p> 在Mac OS X 10.2操作系統(tǒng)上的Macromedia Flash MX專業(yè)版
5、里,這些代碼可以創(chuàng)建一個(gè)與MAC OS X啟動(dòng)過(guò)程中看見(jiàn)的類似的動(dòng)畫。ActionScript第一次以它目前的語(yǔ)法出現(xiàn)是Flash 5版本,這也是第一個(gè)完全可對(duì)Flash編程的版本。這個(gè)版本被命名為ActionScript1.0。Flash 6通過(guò)增加大量的內(nèi)置函數(shù)和對(duì)動(dòng)畫元素更好的編程控制更進(jìn)一步增強(qiáng)了編程環(huán)境的功能。Flash 7(MX 2004)引進(jìn)了ActionScript2.0,它增加了強(qiáng)類型(strong typing)和面
6、向?qū)ο筇卣?,如顯式類聲明, 繼承,接口和嚴(yán)格數(shù)據(jù)類型。ActionScript1.0和2.0使用相同的編譯形式編譯成Flash SWF文件(即Shockwave Flash files,或 'Small Web Format').</p><p><b> 時(shí)間表</b></p><p> Flash Player 2:第一個(gè)支持腳本的版本,包括控
7、制時(shí)間軸的gotoAndPlay, gotoAndStop, nextFrame和nextScene等動(dòng)作。 </p><p> Flash Player 3:增強(qiáng)了載入外部SWF文件的基本腳本支持(loadMovie)。 </p><p> Flash Player 4:第一個(gè)完全實(shí)現(xiàn)腳本功能(稱為動(dòng)作)的播放器。這些腳本擁有簡(jiǎn)練的語(yǔ)法和對(duì)循環(huán),條件,變量和其它基本語(yǔ)言結(jié)構(gòu)的支持。
8、</p><p> Flash Player 5:第一個(gè)擁有真正意義上的ActionScript的版本。依據(jù)ECMAScript并采用基于原型編程,并允許完全的 過(guò)程式編程和面向?qū)ο缶幊獭?</p><p> Flash Player 6:增加了事件處理模型,并且支持switch。 </p><p> Flash Player 7: Flash Player
9、7 提供一些新特性如支持CSS顯示文本和增強(qiáng)顯示效果。 Macromedia Flash編譯器和Flash Player 7同時(shí)支持基于ECMAScript 4 Netscape Proposal的類編程語(yǔ)言ActionScript 2.0。不過(guò)ActionScript 2.0能交叉編譯成ActionScript 1.0的字節(jié)碼,因此它能運(yùn)行于Flash Player 6。 </p><p> Flash Pl
10、ayer 8:增加用于運(yùn)行時(shí)圖象數(shù)據(jù)控制和文件上傳的新類庫(kù)及APIs,ActionScript 2.0功能更為完善。 </p><p> Flash Player 8.5(計(jì)劃于2006春發(fā)布release版本,currently in public beta):增加ActionScript 3.0和一個(gè)稱為AVM2(ActionScript Virtual Machine 2)新的虛擬機(jī),它可以與前版本AVM
11、1共存以便支持舊內(nèi)容。增強(qiáng)性能是該版本的主要目標(biāo)。 </p><p> Flash Player 9 2007發(fā)表,這是adobe收購(gòu)Macromedia后的第一個(gè)版本,并且也是Mac OS X上第一個(gè)Universal版本的Flash Player。[1] </p><p><b> 語(yǔ)言</b></p><p><b> 語(yǔ)
12、法</b></p><p> 在ActionScript 2.0 類、與函式館物件(如影片片段)可與類聯(lián)系在一起。類總寫在外在文件檔案內(nèi),并且這些文件必須有.as后綴。類是增設(shè)部分──對(duì)ActionScrip語(yǔ)言來(lái)說(shuō),可讓程式員自行開(kāi)發(fā),雖然有許多內(nèi)建類譬如MovieClip類──可被用來(lái)動(dòng)態(tài)地在屏幕上畫出向量──已經(jīng)滿足需求了。類檔案可用來(lái)使您編程更加容易,并且類檔案如果需要的話可在許多專案間轉(zhuǎn)移
13、。</p><p> Flash ActionScript實(shí)現(xiàn)的特點(diǎn)如下,JavaScript程式員也許感興趣:</p><p> 一切設(shè)計(jì)是異步的;callback是普遍存在的,但事件對(duì)象不存在。 </p><p> XML的實(shí)現(xiàn)從Flash 5便存在了。Flash可送和收XML,該項(xiàng)功能可用來(lái)透過(guò)網(wǎng)絡(luò)服務(wù)器創(chuàng)造網(wǎng)上多玩者游戲。 </p>&l
14、t;p> ActionScript 代碼常常直接寫在Flash開(kāi)發(fā)環(huán)境。該環(huán)境提供參考、代碼提示和句法強(qiáng)調(diào)。原代碼常常與電影一起存在.fla檔案里。自外部文件檔透過(guò)#include語(yǔ)法導(dǎo)入ActionScript代碼也相當(dāng)常見(jiàn)。在這種情況下,外部檔案也許被Flash集成開(kāi)發(fā)環(huán)境內(nèi)建編譯器,或Motion Twin ActionScript2編譯器(MTASC)編譯。參見(jiàn)外部鏈接。</p><p><
15、b> 評(píng)論</b></p><p> 編程人員們說(shuō)Macromedia ActionScript 2.0編譯器有點(diǎn)慢,常?;ê脦追昼姴啪幾g100個(gè)類,然而開(kāi)放源碼編譯器MTASC可以利用;它快多了。 </p><p> ActionScript非常寬大的語(yǔ)法常常讓編程人員們皺眉,因?yàn)樗3W尣桓蓛舸a難以閱讀。在Flash里使用許多向量可能拖慢執(zhí)行許多應(yīng)用程序的機(jī)器
16、的效能,因?yàn)镕lash每幀每幀重畫每個(gè)向量。Flash 8引進(jìn)了cacheAsBitmap 變量,它暫時(shí)把向量轉(zhuǎn)換到位圖,這種做法幫助降低了延滯。 </p><p> Flash的ActionScript VM傾向在觸發(fā)內(nèi)部的暫停處理前就非??爝_(dá)到它的運(yùn)算極限,特別在麥金塔版的Flash播放器上更嚴(yán)重。例如,簡(jiǎn)單從1算到5000會(huì)威脅某些用戶Flash播放器的能力。 </p><p>
17、 在Flash 8里許多人不喜歡引入(import)某些類直到要用到那些類前最后一刻。不幸的是,ActionScript 3.0相當(dāng)倚賴引入類,沒(méi)有導(dǎo)入撰寫腳本(scripting)實(shí)際上不太可能。 </p><p> .swf檔案格式挺容易反組譯,使它非常難以保持源代碼機(jī)密。 </p><p><b> 樣本</b></p><p>
18、ActionScript 2.0 樣本</p><p> 下面打印Hello World。值得注意的是這只能在整合環(huán)境下執(zhí)行,因?yàn)閠race函式只有支援整合環(huán)境。</p><p> trace("Hello world!");</p><p> 下面代碼利用onMouseMove事件當(dāng)鼠標(biāo)移動(dòng)時(shí)輸出現(xiàn)行鼠標(biāo)位置。同樣的這只有在整合環(huán)境下執(zhí)行
19、。</p><p> onMouseMove = function () {</p><p> trace("X: "+_root._xmouse);</p><p> trace("Y: "+_root._ymouse);</p><p><b> };</b></
20、p><p> 這個(gè)較先進(jìn)的范例創(chuàng)造一個(gè)包括數(shù)字與字串的陣列,并利用原形函式(prototype function)與函式遞歸給變量名num指定一個(gè)數(shù),給變量str指定一個(gè)字串。然后,利用MovieClip應(yīng)用程序接口,文字區(qū)域被顯示在屏幕上,文字區(qū)域里頭寫入了變量值。</p><p> var my_Array:Array = new Array("Hello", &q
21、uot;ActionScript", 3, 7, 11, "Flash");</p><p> Array.prototype.pickNumber = function():Number {</p><p> var rand:Number = random(this.length);</p><p> return (typ
22、eof (this[rand]) == "number") ? this[rand] : this.pickNumber();</p><p><b> };</b></p><p> Array.prototype.pickString = function():String {</p><p> var rand
23、:Number = random(this.length);</p><p> return (typeof (this[rand]) == "string") ? this[rand] : this.pickString();</p><p><b> };</b></p><p> var num:Number =
24、 my_Array.pickNumber();</p><p> var str:String = my_Array.pickString();</p><p> _root.createTextField("txt", 1, 10, 10, 530, 390);</p><p> txt.text = "Array = &quo
25、t;+my_Array+"\nRandom Number = "+num+"\nRandom String = "+str;</p><p> ActionScript 3.0 樣本</p><p> 下面先進(jìn)的Hello World程序目前需要在Flex 2.0公開(kāi)Alpha測(cè)試版整合環(huán)境中編譯。</p><p><
26、;b> package {</b></p><p> import flash.display.TextField;</p><p> import flash.display.MovieClip;</p><p> import flash.filters.DropShadowFilter;</p><p> p
27、ublic class HelloWorld extends MovieClip {</p><p> public function HelloWorld() {</p><p> var shad:DropShadowFilter = new DropShadowFilter(2, 45, 0x000000, 25, 3, 3, 2, 2);</p><p>
28、; var txt:TextField = new TextField();</p><p> txt.textColor = 0xFFFFFF;</p><p> txt.filters = [shad];</p><p> txt.width = 120;</p><p> txt.x = Math.random()*300;&
29、lt;/p><p> txt.y = Math.random()*300;</p><p> txt.selectable = false;</p><p> txt.text = "Hello World! ["+Math.round(txt.x)+","+Math.round(txt.y)+"]";&
30、lt;/p><p> addChild(txt);</p><p><b> }</b></p><p><b> }</b></p><p><b> }</b></p><p><b> 英文原文:</b></p&g
31、t;<p> ActionScript</p><p> ActionScript is a scripting language based on ECMAScript. ActionScript is used primarily for the development of websites and software using the Adobe Flash Player platfor
32、m (in the form of SWF files embedded into Web pages), but is also used in some database applications (such as Alpha Five), and in basic robotics, as with the Make Controller Kit. Originally developed by Macromedia, the l
33、anguage is now owned by Adobe (which acquired Macromedia in 2005). ActionScript was initially designed for con</p><p><b> History</b></p><p> ActionScript started as a scripting la
34、nguage for Macromedia's Flash authoring tool, now developed by Adobe Systems as Adobe Flash. The first three versions of the Flash authoring tool provided limited interactivity features. Early Flash developers could
35、attach a simple command, called an "action", to a button or a frame. The set of actions was basic navigation controls, with commands such as "play", "stop", "getURL", and "got
36、oAndPlay".</p><p> With the release of Flash 4 in 1999, this simple set of actions became a small scripting language. New capabilities introduced for Flash 4 included variables, expressions, operators,
37、 if statements, and loops. Although referred to internally as "ActionScript", the Flash 4 user manual and marketing documents continued to use the term "actions" to describe this set of commands .<
38、/p><p> Timeline by player</p><p> Flash Player 2: The first version with scripting support. Actions included gotoAndPlay, gotoAndStop, nextFrame and nextScene for timeline control. </p>&
39、lt;p> Flash Player 3: Expanded basic scripting support with the ability to load external SWFs (loadMovie). </p><p> Flash Player 4: First player with a full scripting implementation (called Actions). Th
40、e scripting was a flash based syntax and contained support for loops, conditionals, variables and other basic language constructs. </p><p> Flash Player 5: Included the first version of ActionScript. Used p
41、rototype-based programming based on ECMAScript, and allowed full procedural programming and object-oriented programming. </p><p> Flash Player 6: Added an event handling model, accessibility controls and su
42、pport for switch. The first version with support for the AMF and RTMP protocols which allowed for ondemand audio/video streaming. </p><p> Flash Player 7: Additions include CSS styling for text and support
43、for ActionScript 2.0, a programming language based on the ECMAScript 4 Netscape Proposal with class-based inheritance. However, ActionScript 2.0 can cross compile to ActionScript 1.0 byte-code, so that it can run in Flas
44、h Player 6. </p><p> Flash Player 8: Further extended ActionScript 1/ActionScript 2 by adding new class libraries with APIs for controlling bitmap data at run-time, file uploads and live filters for blur an
45、d dropshadow. </p><p> Example of ActionScript 2.0 running on Macromedia Flash 8.Flash Player 9 (initially called 8.5): Added ActionScript 3.0 with the advent of a new virtual machine, called AVM2 (ActionSc
46、ript Virtual Machine 2), which coexists with the previous AVM1 needed to support legacy content. Performance increases were a major objective for this release of the player including a new JIT compiler. Support for binar
47、y sockets, E4X XML parsing, full-screen mode and Regular Expressions were added. This is the firs</p><p> Flash Player 10 (initially called Astro): Added basic 3D manipulation, such as rotating on the X, Y,
48、 and Z axis, and a 3D drawing API. Ability to create custom filters using Adobe Pixel Bender. Several visual processing tasks are now offloaded to the GPU which gives a noticeable decrease to rendering time for each fram
49、e, resulting in higher frame rates, especially with H.264 video. There is a new sound API which allows for custom creation of audio in flash, something that has never been possible</p><p> Timeline by Actio
50、nScript version</p><p> 2000–2003: ActionScript "1.0" With the release of Flash 5 in September 2000, the "actions" from Flash 4 were enhanced once more and named "ActionScript"
51、 for the first time.[3] This was the first version of ActionScript with influences from JavaScript and the ECMA-262 (Third Edition) standard, supporting the said standard's object model and many of its core data type
52、s. Local variables may be declared with the var statement, and user-defined functions with parameter passing and return values can a</p><p> 2003–2006: ActionScript 2.0 The next major revision of the langua
53、ge, ActionScript 2.0, was introduced in September 2003 with the release of Flash MX 2004 and its corresponding player, Flash Player 7. In response to user demand for a language better equipped for larger and more complex
54、 applications, ActionScript 2.0 featured compile-time type checking and class-based syntax, such as the keywords class and extends. (While this allowed for a more structured object-oriented programming approach, the</
55、p><p> 2006–today: ActionScript 3.0 In June 2006, ActionScript 3.0 debuted with Adobe Flex 2.0 and its corresponding player, Flash Player 9. ActionScript 3.0 was a fundamental restructuring of the language, so
56、 much so that it uses an entirely different virtual machine. Flash Player 9 contains two virtual machines, AVM1 for code written in ActionScript 1.0 and 2.0, and AVM2 for content written in ActionScript 3.0. Actionscript
57、 3.0 added limited support for hardware acceleration ( DirectX, OpenGL ).</p><p> The update to the language introduced several new features:</p><p> Compile-time and runtime type checking—typ
58、e information exists at both compile-time and runtime. </p><p> Improved performance from a class-based inheritance system separate from the prototype-based inheritance system. </p><p> Suppor
59、t for packages, namespaces, and regular expressions. </p><p> Compiles to an entirely new type of bytecode, incompatible with ActionScript 1.0 and 2.0 bytecode. </p><p> Revised Flash Player A
60、PI, organized into packages. </p><p> Unified event handling system based on the DOM event handling standard. </p><p> Integration of ECMAScript for XML (E4X) for purposes of XML processing. &
61、lt;/p><p> Direct access to the Flash runtime display list for complete control of what gets displayed at runtime. </p><p> Completely conforming implementation of the ECMAScript fourth edition d
62、raft specification. </p><p> Flash Lite</p><p> Flash Lite 1.0: Flash Lite is the Flash technology specifically developed for mobile phones and consumer electronics devices. Supports Flash 4 A
63、ctionScript. </p><p> Flash Lite 1.1: Flash 4 ActionScript support and additional device APIs added. </p><p> Flash Lite 2.0 and 2.1: Added support for Flash 7 ActionScript 2.0 and some additi
64、onal fscommand2 API. </p><p> Flash Lite 3: Added support for Flash 8 ActionScript 2.0 and also FLV video playback. </p><p><b> Syntax</b></p><p> ActionScript code i
65、s free form and thus may be created with whichever amount or style of whitespace that the author desires. The basic syntax is derived from ECMAScript.</p><p> ActionScript 2.0</p><p> The foll
66、owing code, which works in any compliant player, creates a text field at depth 0, at position (0, 0) on the screen (measured in pixels), that is 100 pixels wide and high. Then the text parameter is set to the "Hello
67、, world!" string, and it is automatically displayed in the player:</p><p> createTextField("greet", 0, 0, 0, 100, 100);</p><p> greet.text = "Hello, world";</p>
68、<p> When writing external ActionScript 2.0 class files the above example could be written in a file named Greeter.as as following.</p><p> class com.example.Greeter extends MovieClip</p><
69、p><b> {</b></p><p> public function Greeter() {}</p><p> public function onLoad() :Void</p><p><b> {</b></p><p> var txtHello:TextField
70、= this.createTextField("txtHello", 0, 0, 0, 100, 100.);</p><p> txtHello.text = "Hello, world";</p><p><b> }</b></p><p><b> }</b></
71、p><p> ActionScript 3.0</p><p> ActionScript 3.0 has a similar syntax to ActionScript 2.0 but a different set of APIs for creating objects. Compare the script below to the previous ActionScript 2
72、.0 version:</p><p> var greet:TextField = new TextField();</p><p> greet.text = "Hello World";</p><p> this.addChild(greet);</p><p> Minimal ActionScript
73、3.0 programs may be somewhat larger and more complicated due to the increased separation of the programming language and the Flash IDE.</p><p> Presume the following file to be Greeter.as:</p><p&
74、gt; package com.example</p><p><b> {</b></p><p> import flash.text.TextField;</p><p> import flash.display.Sprite;</p><p> public class Greeter extends
75、 Sprite</p><p><b> {</b></p><p> public function Greeter()</p><p><b> {</b></p><p> var txtHello:TextField = new TextField();</p><
76、;p> txtHello.text = "Hello World";</p><p> addChild(txtHello);</p><p><b> }</b></p><p><b> }</b></p><p><b> }</b>&
77、lt;/p><p> (See also: Sprite)</p><p> Finally, an example of using ActionScript when developing Flex applications, again presuming the following content to be in a file named Greeter.as:</p>
78、;<p><b> package</b></p><p><b> {</b></p><p> public class Greeter</p><p><b> {</b></p><p> public static function sayHe
79、llo():String</p><p><b> {</b></p><p> var greet:String = "Hello, world!";</p><p> return greet;</p><p><b> }</b></p><p&
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 眾賞文庫(kù)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 計(jì)算機(jī)專業(yè)畢業(yè)設(shè)計(jì)文獻(xiàn)翻譯
- 計(jì)算機(jī)專業(yè)畢業(yè)設(shè)計(jì)外文文獻(xiàn)翻譯部分
- 計(jì)算機(jī)專業(yè)畢業(yè)設(shè)計(jì)外文翻譯
- 計(jì)算機(jī)專業(yè)畢業(yè)設(shè)計(jì)-外文翻譯
- 計(jì)算機(jī)專業(yè)畢業(yè)設(shè)計(jì)外文翻譯27
- 計(jì)算機(jī)專業(yè)畢業(yè)設(shè)計(jì)外文翻譯--internet
- 計(jì)算機(jī)專業(yè)外文翻譯(文獻(xiàn)翻譯)
- 計(jì)算機(jī)相關(guān)專業(yè)畢業(yè)設(shè)計(jì)電阻式觸摸屏--文獻(xiàn)翻譯
- 計(jì)算機(jī)專業(yè)畢業(yè)設(shè)計(jì)外文資料翻譯3
- 計(jì)算機(jī)專業(yè)畢業(yè)設(shè)計(jì)-外文翻譯--matlab 介紹
- 計(jì)算機(jī)專業(yè)畢業(yè)設(shè)計(jì)外文文獻(xiàn)及譯文
- 計(jì)算機(jī)專業(yè)外文翻譯(文獻(xiàn)翻譯)
- 130計(jì)算機(jī)專業(yè)畢業(yè)設(shè)計(jì)外文文獻(xiàn)翻譯:介紹java web開(kāi)發(fā)
- 計(jì)算機(jī)畢業(yè)設(shè)計(jì)外文翻譯
- 計(jì)算機(jī)專業(yè)畢業(yè)設(shè)計(jì)文獻(xiàn)翻譯--一切都是對(duì)象
- 計(jì)算機(jī)專業(yè)畢業(yè)設(shè)計(jì)外文翻譯--jsp內(nèi)置對(duì)象
- 計(jì)算機(jī)專業(yè)畢業(yè)設(shè)計(jì)外文翻譯--數(shù)據(jù)庫(kù)
- 計(jì)算機(jī)專業(yè)畢業(yè)設(shè)計(jì)(論文)外文翻譯2篇
- 計(jì)算機(jī)專業(yè)畢業(yè)設(shè)計(jì)外文翻譯--ds1820
- 計(jì)算機(jī)專業(yè)畢業(yè)設(shè)計(jì)題目大全
評(píng)論
0/150
提交評(píng)論