Chapter 3. Properties, Methods, and Events

IN THIS CHAPTER

Jump Right In

Properties

Events

Methods

Event Propagation

Frame and Timer Events

Removing Event Listeners

What’s Next?

In addition to the core language fundamentals reviewed in the previous chapter, you will find that the majority of your scripts are written using properties, methods, and events. These are the basic building blocks of most scripted tasks and allow you to get and set characteristics of, issue instructions to, and react to input from, many assets.

This is what we’ll be covering in this chapter:

  • Jump Right In. Get your feet wet right away by starting the chapter with a simple practical example. Adapt the Hello World! example by conveying your greeting one character at a time.

  • Properties. Properties are somewhat akin to adjectives, in that they describe the object being modified or queried. For example, you can check or set the width of a button. Most properties are read-write, in that you can both get and set their values. Some properties, however, are read-only, which means you can ask for, but not change, their values.

  • Events. Events are the catalysts that trigger the actions you write, setting properties and calling methods. For instance, a user might click the mouse button, which would then result in a mouse event. If you write code to react when that event is detected, the event can then cause a function to execute performing the desired actions.

  • Methods. Methods are a bit like verbs. They tell objects to do something, ...

Get Learning ActionScript 3.0, 2nd Edition 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.