Movie Clips have properties such as x, y, width, height, and rotation that can be changed using ActionScript.
Note: It is very important to name the instance on the stage. The MovieClip in the library is named Star. The instance on the stage is named star.
It is a good habit to put all of your actionscript in one layer.
Run the movie buy pressing Ctrl+Enter (Command+Return on the Mac)
When the actionscript code is executed, the x property of the star, which is in the middle of the star, is placed against the left edge of the stage.
The x property determines the distance from the left edge. The y property determines the distance down from the top.
Experiment: Modify the code to change both the x and y values to 0. Try other values for x and y.
Debugging: If you program doesn't work make sure that you have named the instance on the stage star. Make sure that is is all lower case. Make sure that your code exactly matches the code shown. If it still doesn't work, download the source movie and compare carefully to find out what you did wrong.
There are several more properties that you can change using ActionScript3.
Try each of the commands below, then experiment with varoius combinations of them.
Run the movie each time buy pressing Ctrl+Enter (Command+Return on the Mac)
star.width=200; star.height=100; star.rotation=90; star.alpha=.20; star.visible=false;Sometimes we change the value of a property by adding to its current value:
The last statement moves the star to the right by adding 10 to the current value of star.x.
Another way to write this is:
Changing the current value of a property (incrementing it) is so common that this short cut is used most of the time.
Statements that give a new value to a property are called assignment statements.