13.08.2012 Views

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 64: How to Use ActionScript<br />

Examples<br />

Running an ActionScript 3.0 code example is one of the best ways to learn how particular classes and methods work.<br />

You can use examples in differ<strong>en</strong>t ways, dep<strong>en</strong>ding on the devices you are using or targeting.<br />

Computers running Flash Professional or Flash Builder See “Running ActionScript 3.0 examples in Flash<br />

Professional” on page 1087 or “Running ActionScript 3.0 examples in Flash Builder” on page 1088 for information<br />

about how to use these developm<strong>en</strong>t <strong>en</strong>vironm<strong>en</strong>ts to run ActionScript 3.0 examples. Use trace statem<strong>en</strong>ts and other<br />

debugging tools to increase your understanding of how a code example works.<br />

Mobile devices You can run the ActionScript 3.0 code examples on mobile devices that support Flash Player 10.1 and<br />

later releases. See “Running ActionScript 3.0 examples on mobile devices” on page 1089. You can also run these<br />

examples on your computer using Flash Professional or Flash Builder.<br />

TV devices Though you cannot run these examples on TV devices, you can still learn from the examples by running<br />

them on your computer. See Flash Platform for TV on the Adobe Developer Connection website for information about<br />

developing applications for TV devices.<br />

Types of examples<br />

The types of ActionScript 3.0 code examples are:<br />

Code snippet examples (found throughout the ActionScript 3.0 docum<strong>en</strong>tation set)<br />

Class-based examples (found primarily in the ActionScript 3.0 Language Refer<strong>en</strong>ce)<br />

Practical examples containing multiple source files (download source ZIP files from<br />

www.adobe.com/go/learn_programmingAS3samples_flash)<br />

Code snippet examples<br />

A code snippet example looks like this:<br />

var x:int = 5;<br />

trace(x); // 5<br />

Code snippets only contain <strong>en</strong>ough code to demonstrate a single idea. They do not normally contain package or class<br />

statem<strong>en</strong>ts.<br />

Class-based examples<br />

Many examples show the source code for a complete ActionScript class. A class-based example looks like this:<br />

package {<br />

public class Example1 {<br />

public function Example1():void {<br />

var x:int = 5;<br />

trace(x); //5<br />

}<br />

}<br />

}<br />

Last updated 6/6/2012<br />

1085

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!