# ActionScript Programming/PartI/Chapter 1
## Properties

Every Symbol instance in Flash has properties, which control the object itself and how it is displayed and its interaction with the environment. However, Graphic type symbol instances cannot be referenced with action script, since you can´t assign them an instance name.
Actionscript 3.0
Actionscript 3.0 removes the leading underscore for the various properties.
Properties in ActionScript contain an underscore before the property name, to indicate that it pertains to the display or environment. The properties of a symbol instance can be modified in design time or in runtime using action script, an essential task for animation.
In this chapter we will learn to use properties.
* X, Y Coordinates
* x and y are the coordinates of the object. As the screen is 2D the object doesn’t have the 3rd z coordinate. Now let's write a small program. We will draw a ball and then move it to a specified location.
* Step 1
* Select the oval tool from the toolbar and draw a circle.
* Step 2
* Select the oval you have drawn and press F8. "Convert to Symbol" dialog will appear. Type "mov_ball" in the "Name" field, choose "Movie Clip" behavior and press "OK"
* Step 3
* Now select the oval. In the properties window (at the bottom of the screen by default) in the "Instance Name" field (Near "Swap" button) type "ball". Now we can customize our ball’s properties.
* Step 4
* Right click the keyframe in the "Timeline" window and choose "Actions". "Actions" window will appear. In the Script pane write the following:
* ball._x = 200;
* ball._y = 200;
* This example will set the position of the ball to (200, 200). But let's analyze the code. "ball" is our object in the scene. "_x" is the x coordinate of the object and "_y" is the y coordinate of the object. In ActionScript, the properties begin with "_" including the x and y coordinates. In many languages, ";" is put after each line, so that the program could find the end of the statement.

### Width, Height Measures

Width and height are the vertical and horizontal sizes of the object. The use of them are just as the use of x and y properties. Add the following lines to the previous example and you will understand.

### XScale, YScale

Scaling the local coordinate system affects the _x and _y property settings, which are defined in whole pixels. For example, if the parent movie clip is scaled to 50%, setting the _x property moves an object in the movie clip by half the number of pixels as it would if the movie were set at 100%.

### Visible

This property makes the object visible and invisible. To test this property we will need to add one button to the scene. Draw something like button in the scene and convert it to button (using F8), or you can just add the any button from "Common Libraries" in the "Window>Common Libraries" menu. After you have added the button right click it and choose "Actions" from the popup menu. In the Script pane type the following:
But note, if you are using the Normal mode then don’t write this. Choose "Properties" from the left side of the "Actions" window and then double click "_visible". You will notice than the first and third lines will be written automatically, but the second line will just be "_visible". In the "Expression" field above the Script pane write "ball._visible = false". But if you are using the Advanced mode, then copy all the code written above. The first line is the beginning of "Release" event. "Release" event occurs when the user clicks the button. The structure of writing events is "on (<name of event>) {". The "{" tells the program the beginning of the event. And "}" tells the end of the event. So when the user clicks the button, the code written between "{" and "}" is being executed. The second line makes the ball invisible, using "_visible" property. This property can be set to "true" ("yes"), this means visible, and to "false" ("no"), this means invisible. This type of construction ( "true" and "false") is called "Boolean", which you will learn later.

### Rotation

Rotation property specifies the rotation of the object in degrees. To test this property follow the steps.
Step 1
Select the Rectangle Tool in the Toolbox, draw a rectangle, double click the drawn rectangle and press F8 to convert it to symbol. When the "Convert to Symbol" dialog will appear, type "mov_box" as the name of the symbol, choose the "Movie Clip" behavior and press OK. Select the rectangle you have drawn and give "box" name to it.
Step 2
Now right click the Keyframe in Timeline window and choose "Actions" from the popup window to show "Actions" window. When the window is shown, turn on Advanced Mode and write the following:
Now test the movie by pressing Ctrl + Enter and you will see the result.

### Quality

Property quality is not very important. It only changes the quality of the scene. But it doesn’t change the quality of the object, since its quality property is set. Rather it changes the quality of all the movie. For example if you write the following:
then this will decrease not only of the quality of box object, but also the qualities of all other objects.

### Name

This property changes or reads the name of the object. To understand how to use this property let's test it. We will use the example which we used when we were learning "Rotation" property. Right click the keyframe in Timeline window to see the "Actions" window. Now add the following lines to the code:
Test the movie and you will notice that nothing has changed. Why? Because you have changed the name of the "box" to "box2", so now the object with the name "box" doesn’t exist. But if you only replace the word "box" in the second line to "box2" and it will look like "box2._rotation = 45; ", then, by testing the movie you will see that the box is rotated.

### Alpha

Alpha gives the object transparency. If alpha value is set to 0, then the object is completely invisible. If the value is set to 100, then the object is completely visible. You can set alpha value to your object both in design time by choosing "Alpha" in "Color" combo box in the Property window and in runtime, by using ActionScript. To test this add the following line to the previous example.
The following line will make the box transparent.