Using Data Types, Variables, and Constants

Flash animations are made up of different elements, like drawings, text, frames, timelines, and movie clips. Some of these elements serve as containers for the others. For example, frames can hold drawings and text, and timelines hold frames. ActionScript is similar. A few basic elements, like Numbers and Strings, are the building blocks for more complicated data containers. Many programming languages use similar data types but have slightly different rules about the way they're used.

This section introduces the most common data types that you use in ActionScript and explains how they're used. If you've worked your way through this chapter, you've used some of these already. In examples in the following chapters, you'll have an opportunity to give these data types a workout.

Tip

This book isn't an exhaustive reference on ActionScript. It gives you a solid introduction to the language and shows you how to put it to work right away. If you're hungry for more details on the subject, check out the recommendations in the box on Diving Deeper into ActionScript.

Numbers

Numbers are one of the data building blocks ActionScript uses. For example, you may want to tell Flash to play the same movie clip three times. As you saw earlier, Flash uses numbers to identify positions on the stage; to identify certain frames in a timeline, and to identify colors. Numbers are so important that Flash has three different data types for numbers. Why have more than one? ...

Get Flash CS5: The Missing Manual 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.