Chapter 2. ActionScript 3.0 Language Basics

So you want to be an ActionScript coder? Great! This chapter will get you started with the basic syntax and structure of the language. If you have worked with other programming languages, some of the topics covered will be familiar territory for you. ActionScript's syntax is descended from JavaScript, Java, and C. One could call it "C-like," so if you've had experience with another C-like language, the syntax won't be difficult to pick up. Regardless of whether you know a similar language, you should read through this chapter closely so that you don't miss any of the nitty-gritty details.

The Bare Essentials

At its most basic, the grammar of ActionScript 3.0 is a series of statements and organizational structures. You write code in a plaintext file, optionally using spaces, tabs, and newlines as desired to improve readability.

ActionScript code is kept in ActionScript files, generally called class files because they generally contain one public class. These are plaintext files that you edit in your text editor or IDE, as discussed in Chapter 1, "Introducing ActionScript 3.0." The naming and organization of these files depend on their package structure, which you'll learn about in Chapter 4, "Object Oriented Programming."

Note

When using ActionScript 3.0 within Flash Professional, in addition to using class files, you can add code to a timeline. This is a separate way to edit code that doesn't require external files. I won't cover this technique ...

Get ActionScript 3.0 Bible now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.