Properties

A property represents one of the pieces of data that are bundled together in an object. A song object might have properties named artist and title; the MovieClip class has properties like rotation, x, width, and alpha. You work with properties like individual variables--in fact, you might think of properties as simply the "child" variables contained in an object.

Here are some examples of ActionScript code that uses properties. This line of code moves the MovieClip named square to the x coordinate 100 pixels:

square.x = 100;

This code uses the rotation property to make the square MovieClip rotate to match the rotation of the triangle MovieClip:

square.rotation = triangle.rotation;

This code alters the horizontal scale of the square MovieClip so that it's one-and-a-half times wider than it used to be:

square.scaleX = 1.5;

Notice the common structure: you use a variable (square, triangle) as the name of the object, followed by a period (.) and then the name of the property (x, rotation, scaleX). The period, known as the dot operator, is used to indicate that you're accessing one of the child elements of an object. The whole structure together, "variable name-dot-property name," is used like a single variable, as a name for a single value in the computer's memory.


Flash CS3

Take a survey


 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/9.0/main/00000018.html