Flash ActionScript 3 overview: Difference between revisions

The educational technology and digital learning wiki
Jump to navigation Jump to search
 
Line 4: Line 4:
Disclaimer: Until today I have never ''seen'' any ActionScript code. I will use this page to write down a few things. Wait until this message goes away before you can trust anything ! - [[User:Daniel K. Schneider|Daniel K. Schneider]] 15:56, 5 September 2007 (MEST)
Disclaimer: Until today I have never ''seen'' any ActionScript code. I will use this page to write down a few things. Wait until this message goes away before you can trust anything ! - [[User:Daniel K. Schneider|Daniel K. Schneider]] 15:56, 5 September 2007 (MEST)


This is part of the [[Flash]] series of articles.
This is part of the [[Flash]] series of articles. But it is '''not''' a tutorial !!


== Introduction ==
== Introduction ==


{{quotation|ActionScript 3.0 is a dialect of [[ECMAScript]] which formalizes the features of ActionScript 2.0, adds the capabilities of ECMAScript for XML (E4X), and unifies the language into a coherent whole. (Grossman, 2006).


Basically, there are two ways of using ActionScript 3:
* Use the Flash CS3 environment more less as "in the ActionScript 2" way, i.e. you add bits of code to certain frames
* Write your code in a file and compile it (you also may use Flash CS3 that way). No drawings, just code !
== Stand-alone code development with AS 3 ==
You do not need to buy Flash CS3 (that's actually a cool thing) to program in AS3 and to create *.swf files.
; Use Flex SDK 2.0.1 from Adobe
* Download this free SDK from Adobe:
:http://www.adobe.com/products/flex/downloads/
For Windows and Mac there is a Flex Builder plugin for Eclipse.
Otherwise there is a platform independent compiler, the Adobe Flex2 Software Development Kit (SDK).
; Installing the Adobe Flex2 Software Development Kit (SDK) for Windows
* Unzip it somewhere
* Edit the Environment variables through the configuration panel to include the bin directory in the path: I.e. something like ''Parameters->Config Panel->System->Advanced'' (I don't have an English System at hand).
; Installing the Adobe Flex2 Software Development Kit (SDK) for Ubuntu
* Unzip it somewhere (I put it under /usr/local/flex)
* Under Linux change permissions of the shell scripts in the bin directory, in particular ''mxmlc''
* Then add this directory to your path. E.g. under my Ubuntu I added in file ''/etc/bash.bashrc'':
export PATH=${PATH}:/usr/local/flex/bin
; Using the compiler
* Just type something like:
mxmlc HelloWorld.as
.... This will make an *.swf file
Finally, I also need some Emacs code for help with editing (not done yet)
* http://nisheet.wordpress.com/tag/emacs/
== Simple AS3 code patterns ==
=== Event handling ===
; General pattern
   
Definition of an event handler function:
function ''eventResponse'' (eventObject:EventType):void
  {
    // Actions performed in response to the event go here.
  }
Using it:
eventSource.addEventListener(EventType.EVENT_NAME, ''eventResponse'');
; Example
launch_button.addEventListener(MouseEvent.CLICK,launchRocket);
function launchRocket(event:MouseEvent):void {
    gotoAndPlay(2);
}


== Links ==
== Links ==
=== Manuals ===
* [http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/ ActionScript 3.0 Language & Component Reference]
* [http://www.adobe.com/go/programmingAS3 Flex 2 LiveDocs: Programming ActionScript 3.0]
=== Overviews ===
* Grossman, Gary and Huang, Emmy (2006). [http://www.adobe.com/devnet/actionscript/articles/actionscript3_overview.html ActionScript 3.0 overview], Adobe.
* [http://en.wikipedia.org/wiki/Actionscript ActionScript] (Wikipedia)
* [http://flexblog.faratasystems.com/?p=115 Comparing the syntax of Java 5 and ActionScript 3]


=== General Tutorials ===
=== General Tutorials ===
Line 16: Line 83:
* [http://www.senocular.com/flash/tutorials/as3withflashcs3/ Getting Started with ActionScript 3.0 in Adobe Flash CS3]
* [http://www.senocular.com/flash/tutorials/as3withflashcs3/ Getting Started with ActionScript 3.0 in Adobe Flash CS3]


* [http://livedocs.adobe.com/flash/9.0/main/ Adobe Livedocs] has fairly good documentation, e.g.
** [http://livedocs.adobe.com/flash/9.0/main/00000012.html Getting started with ActionScript]
** However, its target are rather programmers.
* [http://www.adobe.com/devnet/actionscript/#migrating_as3 Migrating your Flash applications to ActionScript 3.0]
* [http://www.actionscript.org/resources/categories/Tutorials/ Tutorials] at ActionScript.org has several action script tutorials, e.g.
** [http://www.actionscript.org/resources/articles/611/1/Getting-started-with-Actionscript-3/Page1.html Getting started with Actionscript 3]
* [http://www.kirupa.com/developer/flash/index.htm Kirupa], e.g.
** [http://www.kirupa.com/developer/flashcs3/using_xml_as3_pg1.htm Using XML in Flash CS3/AS3]


=== Example-based tutorials ===
=== Example-based tutorials ===


* [http://www.webwasp.co.uk/tutorials/102/index.php Flash Tutorial - Copy Motion as ActionScript 3.0]
* [http://www.webwasp.co.uk/tutorials/102/index.php Flash Tutorial - Copy Motion as ActionScript 3.0]
=== Examples ===
* [http://www.zeuslabs.us/flex-2-treemap-component/ Flex Treemap Component]
* [http://drawk.wordpress.com/2007/06/25/updated-list-of-best-animation-packages-for-as3/ Updated: List of Best Animation Packages for AS3]
=== ActionScript without Flash CS3 ===
* [http://www.williambrownstreet.net/wordpress/?p=78 Flash/ActionScript3 Programming under Ubuntu] ... Tested, this works :)
=== Blogs and stuff ===
* [http://wordpress.com/tag/actionscript3/ Tag: Actionscript3] at Wordpress

Revision as of 19:49, 5 September 2007

This article or section is currently under construction

In principle, someone is working on it and there should be a better version in a not so distant future.
If you want to modify this page, please discuss it with the person working on it (see the "history")

<pageby nominor="false" comments="false"/>

Disclaimer: Until today I have never seen any ActionScript code. I will use this page to write down a few things. Wait until this message goes away before you can trust anything ! - Daniel K. Schneider 15:56, 5 September 2007 (MEST)

This is part of the Flash series of articles. But it is not a tutorial !!

Introduction

{{quotation|ActionScript 3.0 is a dialect of ECMAScript which formalizes the features of ActionScript 2.0, adds the capabilities of ECMAScript for XML (E4X), and unifies the language into a coherent whole. (Grossman, 2006).

Basically, there are two ways of using ActionScript 3:

  • Use the Flash CS3 environment more less as "in the ActionScript 2" way, i.e. you add bits of code to certain frames
  • Write your code in a file and compile it (you also may use Flash CS3 that way). No drawings, just code !

Stand-alone code development with AS 3

You do not need to buy Flash CS3 (that's actually a cool thing) to program in AS3 and to create *.swf files.

Use Flex SDK 2.0.1 from Adobe
  • Download this free SDK from Adobe:
http://www.adobe.com/products/flex/downloads/

For Windows and Mac there is a Flex Builder plugin for Eclipse. Otherwise there is a platform independent compiler, the Adobe Flex2 Software Development Kit (SDK).

Installing the Adobe Flex2 Software Development Kit (SDK) for Windows
  • Unzip it somewhere
  • Edit the Environment variables through the configuration panel to include the bin directory in the path: I.e. something like Parameters->Config Panel->System->Advanced (I don't have an English System at hand).
Installing the Adobe Flex2 Software Development Kit (SDK) for Ubuntu
  • Unzip it somewhere (I put it under /usr/local/flex)
  • Under Linux change permissions of the shell scripts in the bin directory, in particular mxmlc
  • Then add this directory to your path. E.g. under my Ubuntu I added in file /etc/bash.bashrc:
export PATH=${PATH}:/usr/local/flex/bin
Using the compiler
  • Just type something like:
mxmlc HelloWorld.as 

.... This will make an *.swf file

Finally, I also need some Emacs code for help with editing (not done yet)

* http://nisheet.wordpress.com/tag/emacs/

Simple AS3 code patterns

Event handling

General pattern

Definition of an event handler function:

function eventResponse (eventObject:EventType):void
 {
   // Actions performed in response to the event go here.
 }

Using it:

eventSource.addEventListener(EventType.EVENT_NAME, eventResponse);
Example
launch_button.addEventListener(MouseEvent.CLICK,launchRocket);

function launchRocket(event:MouseEvent):void {
    gotoAndPlay(2);
}

Links

Manuals

Overviews

General Tutorials

Example-based tutorials

Examples

ActionScript without Flash CS3

Blogs and stuff