ActionScript 3.0 language basics
Classes are clever concepts but, as the last section showed, they are pretty useless by themselves. In this section, we'll review the code elements that do all the groundwork. Special emphasis is placed on their relevance to math and physics.
Variables and constants
Remember the var
keyword that we used to declare properties? The keyword var
stands for variable. A variable is a container that holds some value. Here value might mean different things. For example, the following variable x
is defined to hold values that are numbers (we are omitting private keywords):
var x:Number;
Subsequently, x
may only be assigned values that are numbers. For example:
x = 2;
This assignment can be done together with the following ...
Get The Essential Guide to Physics for Flash Games, Animation, and Simulations 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.