Chapter 2. Getting Started with ActionScript 2.0

Computers are dumb; they cannot think for themselves—they can only follow instructions. Computers are also very precise, so they must be told in exact terms what needs to be done. The purpose of a programming language is to provide you with a means of clearly and accurately telling the computer what you want it to do. ActionScript provides this structure in a way that you also can read and understand.

This chapter gets you started learning ActionScript syntax and structure by introducing the statement and the variable. Do not worry about memorizing each fact and concept that's covered in this chapter. The more actual examples you try for yourself, the more comfortable you will become with ActionScript 2.0.

Understanding Statements

When you write a letter or an email message, you create sentences and string them together to form paragraphs. Each sentence is structured of verbs, nouns, adjectives, and other elements of the English language, and each sentence expresses one discrete message. Similarly, writing code is a process of creating individual statements that communicate to Flash one discrete task that you want it to perform. A sequence of statements spells out how to perform a larger task in detail, much like sentences are strung together into paragraphs to explain a larger idea.

Using Simple Statements

The building block of ActionScript coding is the simple statement, generally just referred to as a statement. Each statement represents ...

Get Beginning ActionScript 2.0 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.