Publishers of technology books, eBooks, and videos for creative people

Home > Articles > Design > Adobe Creative Suite

  • Print
  • + Share This
This chapter is from the book

About Methods and Properties

Each object of a class (Zeke of the humans, for example) differs from the others in its class by more than just its name. Each person differs because of several characteristics that define the individual, such as height, weight, gender, and hair color. In object- oriented scripting, we say that objects and classes have properties. Height, weight, sex, and hair color are all properties of the human class (Figure 3.3).

Figure 3.3Figure 3.3 Adam, Betty, and Zeke are human objects with different properties. Properties differentiate objects of the same class.

In Flash, each class has a predefined set of properties that let you establish the uniqueness of the object. The Sound class has just two properties: duration, which measures the length of a sound, and position, which measures the time the sound has been playing. The MovieClip class, on the other hand, has many properties, such as _height, _width, and _rotation, which are measures of the dimensions and orientation of a particular movie-clip object. By defining and changing the properties of objects, you control what each object is like and how each object appears, sounds, or behaves to the user.

Objects also do things. Zeke can run, sleep, or talk. The things that objects can do are known as methods. Each class has its own set of methods. The Sound class, for example, has a setVolume method that will play its sound louder or softer, and the Date class has a getDay method that retrieves the day of the week. When an object does something by using a method, we say that the method is called or that the object calls the method.

Understand the relationships between objects, classes, properties, and methods is important. Putting objects together so that the methods and properties of one influence the methods and properties of another is what drives Flash interactivity. The key to building your ActionScript vocabulary is learning the properties and methods of different classes.

  • + Share This
  • 🔖 Save To Your Account