Chapter 4. Working with Nonvisual Classes

Perform Simple Mathematical Operations

You can perform basic mathematical operations in ActionScript by simply entering the formula that you want as the value of an expression. You can perform addition, subtraction, multiplication, and division. The symbols for each are the standard symbols used throughout the computer world: + for addition, - for subtraction, * for multiplication, and / for division. ActionScript also supports the modulus operator, %, which returns the remainder in a division problem.

ActionScript also follows the normal order of operations for math. If you are going to combine addition, subtraction, multiplication, and division into a single expression, the multiplication will occur first ...

Get ActionScript®: Your visual blueprint™ for creating interactive projects in Flash® CS4 Professional 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.