|Advance Scripting In Flash - Part 4 |
In the previous article of Flash 5 Tutorial Series we had discussed about FS Command, Stop all Sounds, Tell Target, If Frame is Loaded. Now lets Continue with Set Variable, Set Property, Get Property, XY Position, XY Scale, Visibility, Rotation & Alpha.
Using set variable, any value can be set to a variable. The name of the variable is declared and a value is assigned to it.
set variable = value;
x = 2;
where x is the variable name & 2 is the value of the variable.
Using this command, the property of the movie clip can be changed while playing the movie.
The instance name of a movie clip is needed while making changes to the property of it. The set property has three arguments.
set property (target, property, value);
set property ("plane", _xscale, 100);
The Movie clip will expand in width by 100 of its original width.
Using this action the value for the movie clip can be returned.
Get property (target, property);
| || |
target is the instance name of movie clip.
| ||Property is the property of movie clip (_x, _y, _xscale etc) |
galaxy = get property ("plane", _x) +10;
set property ("plane", _x, galaxy);
The x position of plane movie clip will be increased by ten (whenever the button is pressed) and stored in x variable. Now the set property will set the x value to the movie clip.
In the above discussed example, We have
galaxy = get property(); in which we have involvement of Set Variable and Get property commands.
The next line explain us the Set Property command.