While there were some ActionScripts in the earlier versions of Flash, the language really didn't get its start until the year 2000, when it was officially named. Heavily influenced by JavaScript, the language went from a few simple commands to an evolving powerhouse of functions. This article will explain some of those functions.
The Width and Height properties define how tall and wide the object is. You can program them in a fashion similar to that of the X,Y coordinates. Here we will create a program that resizes the Rectangle object once the user clicks on it.
onClipEvent (mouseDown) {
setProperty("", _height, "300");
setProperty("", _width, "300");
}
Xscale/YScale
Another way to adjust the size of an object is with the Xscale and Yscale properties. These allow you to, using scale, stretch the size of an image. If I set both values at 50, the object will become half of its size. If I set them at 200, the object becomes twice its size.
Here is some code that demonstrates how to change the properties:
onClipEvent (mouseDown) {
setProperty("", _xscale, "50");
setProperty("", _y, "300");
}
You can fool around with different numbers to generate different effects. For instance, if you set either property to 0, then your object disappears. If you set it to a negative number like -100, it enlarges the picture in a weird way and relocates it.
Here are some pretty pictures to demonstrate how this works.
Before the user clicks on the image:
After the user clicks on the image (value set to 200)