Understanding Macromedia Flash 8 ActionScript 2: Basic Techniques for Creatives

Chapter 8: The Building Blocks of Code

Variables, Operators, Statements, and Functions

Classes and Object Oriented Programming techniques are important, powerful, helpful, modern, etc. But the essential building blocks of code haven't changed since the dawn of computing when vacuum tubes were new.

To make any kind of program work, several things are required:

  • Memory to store data: Variables.

  • The ability to manipulate data: Operators.

  • Control over the order of operation: Statements.

  • A way to make code modular: Functions.

It may be helpful to know that all computer languages are the same essentially. The most powerful chips (CPUs) in use today all do pretty much the same things. And today's chips are pretty much the same as yesterdays. They are just faster and have fewer resource limitations. Likewise, programs are bigger and more "feature-rich" but they operate in the same way as the first Eniac programs:

  • Get some data

  • Manipulate the data

  • Make some decisions about the data

  • Store the data

  • Get some more data

It should come as no surprise, then, that the essential building blocks of AS2 code are the same as they were for AS1.

Variables

Programs retrieve, manipulate, and store data in memory. At the hardware level, this memory exists as microscopic transistor networks. In ActionScript, memory exists in the form of variables. A variable is a container that stores a piece of data. The location of the container doesn't change, but the contents can. To access memory on a memory chip, the memory address must be known. Early programmers...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Computers
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.