• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 3. Getting a Handle on ActionScript > About Objects and Classes

About Objects and Classes

At the heart of ActionScript are objects and classes. Objects are data types, such as sound, graphics, text, or numeric values, that you create in Flash and use to control the movie. For example, a date object is used to retrieve information about the time and the date. And an array object is used to manipulate data stored in a particular order. All of the objects you create belong to a larger collective group known as a class. Flash provides certain classes for you to use in your movie. These predefined classes are also referred to as objects, but they are named and capitalized. For example, the Color object is a class from which different color objects are created. Learning to code in ActionScript centers on understanding the capabilities of these objects and their classes, and using them to interact with each other and with the viewer.

In the real world, we are familiar with objects like a cow, a tree, or a person (Figure 3.1). Flash objects range from visible things, such as a spinning ball, to more abstract concepts, such as the date, pieces of data, or the detection of keyboard inputs. Whether concrete or abstract, however, Flash objects are versatile because once you create them, you can reuse them in different contexts. Before you can use objects, you need to be able to identify them, and you do so by name just as we do in the real world. Say you have three people in front of you, Adam, Betty, and Zeke. All three are objects that can be distinguished by name. All three belong to the collective group known as humans. You could also say that Adam, Betty, and Zeke are all instances of the human class (Figure 3.2). In ActionScript, instances and objects are synonymous, and the terms are used interchangeably in this book.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint