Welcome To MyFreeWebTemplates.info Flash Tutorials Area - Set Property
This tutorial is going to cover how to use the
"setProperty" action to change different propeties of an object
using action scripts only.
We're going to use the "scale property" for this tutorial as
an example.
In addition to that, you're going to be introduced to using
"input" text fields to change the values.
1:
Start by converting the object you desire to change its properties to a
Movie Clip and add an Instance Name to it, I called mine
flashtext.
Create a button. This button is going to be used to apply the
actions.
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%
Fig 1
The scale property is only one of the many properties that
can be chosen from a drop-down menu as shown in Fig1.
2:
Going well? Ok, let's make this more dynamic now and allow the user to enter
whatever value he desires. We're going to use input fields for this.
Select the Text Tool, choose "Input
Text" in the properties bar and draw 2 fields on the stage.
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); }
Notice, 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
"".
Test your movie!
Conclusion:
What we did:
Converted the object to a Movie Clip and added an instance name to it
Created a button to set the values on release
Added an action to the button to change the scale property of our Movie
Clip.
Took this one step further by adding Input Fields to allow users enter
whatever value they desire, added a variable name to each field
Welcome to MyFreeWebTemplates.info we have a collection of Free Templates available for download created by designers from around the globe. Our collection is growing daily so be sure to check back often for more Free Templates. If you can't find a Free Template that suits your needs, we may offer you many professional web templates and flash web templates.
Website templates are pre-made website designs that you can customize and personalize to suit your company's image.You can save time and money by using website templates for your design project.