|
|
| |
Dear Friend,
Hello, & welcome back to FIREWIRE,
your friendly guide to the exciting world of web-design
& web-solutions! In the previous newsletter of Flash
5 Tutorial Series we had discussed Bitwise Operators,
Comparison Operators, Logical Operators, Numeric Operators,
String Operators, Operators. Now lets Continue with
While Statement, If & Else Statement, Start &
Stop Drag, Focus Rectangle, Sound Buftime, & High
Quality. |
 |
|
Using while statement, a series of statements is repeated
in a loop as long as the condition is true. If the specified
condition is not satisfied, the condition returns (Boolean
value) false and the loop won't be executed.
For
each and every loop, flash restarts the loop by testing
the condition. If the condition is false, flash skips
the rest of the statements. Looping is performed repeatedly
until the condition is false.
Syntax
:
while (condition)
{
// statements;
}
Where condition is used to evaluate the loop each time
when the loop is performed.
Statements
are expressions to run, if the condition returns true.
Example:
x = 0;
While (x<=10)
{
trace (x);
x=x+1;
}
Initially,
x value is zero and the condition is x<=10. If the
value is less than 10, then x value will be traced.
Then value of x is incremented and again the loop starts
and it end only if the value of x is greater than 10.
(i.e. condition returns false).
|
 |
|
This statement (if) is used to evaluate the condition
to determine the next action in the movie. If the specified
condition is true, flash runs the rest of the statements.
If
statement is used to create a branching logic in scripts.
Syntax:
If (condition)
{
// statements ;
}
Where
condition is the expression which evaluates to true
or false.
Example:
If (name = = "galaxy")
{
goto and stop (5);
}
If
the value given by user is equal to the original name,
then it will move to fifth frame, otherwise it won't
enter the loop.
|
 |
|
An alternative statement to run the if condition. If
the value of IF statement is false, then ELSE condition
is executed.
Syntax:
If (condition)
{
// statements ;
}
else
{
// statements;
}
where
the condition is false and automatically control is
shifted to else statements. Then corresponding statements
of else is executed.
Example:
If (name = = "galaxy")
{
gotoAnd Play(5);
}
else
{
goto And stop(1);
}
In
the example, if the value entered by the user is equal
to "galaxy", then frame 5 will be played.
If the value is not equal to galaxy, then it will stop
in frame 1.
|
 |
|
This command is used to make the target movie clip as
draggble, while playing the movie. The object can be
dragged, anywhere as the mouse cursor moves.
Start
drag operation starts and the movie clip is draggable
until it is explicitly stopped.
Syntax:
Start drag (target, [lock, [L, B, R, T]])
Where
target is the instance name of the movie.
Lock
is used to lock the mouse to the center point of the
object.
L,
B, R, T is Left, Bottom, Right and Top values of the
object when mouse is moved or pressed.
Example
:1
Start drag ("car", true);
Lock
mouse to center - True / false
In the above example, car is the instance name and
mouse is locked to the center and movie is draggable.
Example:2
Start drag ( "Car", true, 25, 50, 25, 50);
In
this example, while pressing the button, the object/movie
clip will be moved to the corresponding (L, T, B, R)
location.
In
start drag, the movie clip can be made draggable (or)
move it to corresponding position.
|
 |
|
Stop Drag will stop the current dragging operation.
Once the start drag operation is started, only by using
stop drag command, it can be stopped.
Syntax:
stop drag( );
It
has no parameters.
Example
:
on (press)
{
stop drag ( );
}
While
pressing the button dragging option will be stopped.
|
 |
|
Using this command, a yellow rectangle can be obtained
for button which has the focus. This accepts only Boolean
value.
Syntax:
Show focus rectangle = (Boolean value)
_focusrect = (true/false)
If
the tab button is used, then the corresponding button
which obtains the focus will have a yellow rectangle.
Example:
on (press)
{
_focusrect;
}
while
using the tab key, the focus is brought to the button
and a yellow rectangle appears on the button.
|
 |
|
This command is used to establish the number of second
of streaming sound to pre buffer. The default value
is 5 seconds. It only accepts integer.
Syntax:
_soundbuftime = integer;
Default
value is 5 second and any value can be specified for
buffer time.
|
 |
|
Anti-aliasing can be given to objects to smoothen the
ends. To smoothen the bitmap, specify high quality value
to 1. To obtain high quality, specify 2. If value 0
is specified, low quality is obtained and it will prevent
anti-aliasing.
Syntax:
_highquality
= value ;
| value
can be 0,1,2 |
|
|
0
- low quality
|
|
|
1
- smoothing |
|
|
2
- high quality |
Name
: This command is used to set or retrieve the value
of a instance name of a movie clip.
The
value can be set using the name command.
Syntax:
instancename._name;
- retrieve the value
instancename.name = value; to set the value
Regards,
All accompanying logos, brands
and product names are trademarks of their respective
companies.
|
|
|
|
|