One of the primary improvements offered in the step up from Flash 4 to Flash 5 is the setProperty function. Each Flash object has a set of properties that govern its appearance in the movie. Learning to manipulate these properties can give you a strong level of control over your object.
For instance, a simple Flash programming trick can be to use a button to make an object appear or disappear. The code for the small Flash movie below is to its right.
|
The code involved in this movie can be read like this:
When the user clicks and releases the mouse, check to see if the property _visible on the object called words has the value true. If the property does have the value true, change the value to false, otherwise, change the value to true.The button changes the property of the words object. This simple process can serve as the basis for a wide variety of actions you might wish to program. Below are several of the properties available, and what they do.
| Property name | Function |
|---|---|
| _alpha | Controls transparency. The higher the alpha color, the less transparent the object is (100 = opaque). |
| _name | The name of the object. The name is the shorthand way to refer to an object. |
| _rotation | The object's orientation. By adjusting rotation, you can make the object rotate |
| _visible | A true/false value that indicates whether the object is visible or not. |
| _x | A pixel number, counted to the right from the upper left corner. Adding to it will move the object to the right. |
| _xscale | A number reflecting the horizontal scale of the instance from its original symbol. Doubling this will make your object twice as wide. |
| _y | A pixel number, counted down from the upper left corner. Subtracting from it will move the object up the screen. |
| _yscale | A number reflecting the vertical scale of the instance from its original symbol. Halving this number will make your object half as tall. |