Common program elements

In addition to declaring variables, creating object instances, and manipulating objects using their properties and methods, there are a few other building blocks that you use to create an ActionScript program.

Subtopics

Operators
Comments
Flow control

Operators

Operators are special symbols (or occasionally words) that are used to perform calculations. They are mostly used for math operations, and also used when comparing values to each other. As a general rule, an operator uses one or more values and "works out" to a single result. For example:

Comments

As you're writing ActionScript, you'll often want to leave notes to yourself, perhaps explaining how certain lines of code work or why you made a particular choice. Code comments are a tool you can use to write text that the computer should ignore in your code. ActionScript includes two kinds of comments:

Another common use of comments is to temporarily "turn off" one or more lines of code--for example, if you're testing out a different way of doing something, or trying to figure out why certain ActionScript code isn't working the way you expect.

Flow control

Many times in a program, you will want to repeat certain actions, perform only certain actions and not others, perform alternative actions depending on certain conditions, and so on. Flow control is the control over which actions are performed. There are several types of flow control elements available in ActionScript.


Flash CS3

Take a survey


 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/9.0/main/00000025.html