We will learn how to use the “setProperty” action to change different propeties of an object using action scripts only.
Things we use:
- scale property
- input (input text fields )
What we will do:
-
Convert the object to a Movie Clip and added an name to it.
- Create a button to set the values on release.
- Add an action to the button to change the scale property of our Movie Clip.
- Add Input Fields to allow users enter whatever value they desire, added a variable name to each field.
- Start by converting the object you desire to change its properties to a Movie Clip and add an Instance Name to it, I called this one flashtext.
- Create a button. This button is going to be used to apply the actions.
Step 1
Now let’s add the following action to your button:
on (release) {
setProperty(“flashtext“, _xscale, “200“);
setProperty(“flashtext“, _yscale, “200“);
}
The above action sets the property of flashtext, which is the instance name of our movie clip, to increase its X and Y scales 200%
The scale property is only one of the many properties that can be chosen from a drop-down menu as shown in Fig1.
Step 2
Allow the user to enter whatever value he desires. We’re going to use input fields for this.
- Select one of the text fields and go to the Properties bar. Add a variable name to it, I called on of them xinput and the other one yinput.

- Modify the previous Action Script to the following:
on (release) {
setProperty(“flashtext“, _xscale, xinput);
setProperty(“flashtext“, _yscale, yinput);
}
Note:We replaced the values with the variable names. This means whatever value is entered into the text fields will be entered there! Make sure the value is set to expression, meaning without the quotation marks “”.





Trackbacks/Pingbacks
[...] How to use Flash set property | Flash tutorials | Flash video … [...]