- How Computers Think
- Commands, Functions and Operations
- Variables
- Conditions
- Loops
- Achieving the Impossible
- Writing Bug-Free Code
- Summary
- Q&A
- Workshop
Commands, Functions and Operations
So far, I have used the term keywords to describe elements of ActionScript. For instance, gotoAndPlay is a keyword. It is also a command.
A command is an element of ActionScript that tells Flash to do something specific. Commands are obeyed as long as they make sense. For instance, if you use gotoAndPlay with a frame label that doesn't exist, the command cannot be executed.
Commands are the most basic element of programming. In Flash, little can be done without using at least one command. We'll be learning many commands throughout the rest of the book.
Functions are terms in ActionScript that perform a calculation and return a result. For instance, a function might take a single number and return the square root of that number.
Both commands and functions can take one or more parameters. A parameter is a value passed to the command or function. The gotoAndPlay command needs at least one parameter to work: the name or number of the frame to go to. A square root function would need a single number value as a parameter.
Different than commands and functions are operators. These are usually symbols, not words. For instance, the + operator performs addition between two values.
You'll be using commands, functions, and operators throughout your ActionScript programming.