EasyManua.ls Logo

MACROMEDIA FLASH MX 2004 - ACTIONSCRIPT - Page 399

MACROMEDIA FLASH MX 2004 - ACTIONSCRIPT
816 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
ifFrameLoaded 399
The following example uses an if action to evaluate when a draggable object in the SWF file is
released by the user. If the object was released less than 300 milliseconds after dragging it, the
condition evaluates to
true and the statements inside the curly braces run. Those statements set
variables to store the new location of the object, how hard it was thrown, and the speed at which
it was thrown. The
timePressed variable is also reset. If the object was released more than 300
milliseconds after it was dragged, the condition evaluates to
false and none of the
statements run.
if (getTimer()<timePressed+300) {
// if the condition is true,
// the object was thrown.
// what is the new location of this object?
xNewLoc = this._x;
yNewLoc = this._y;
// how hard did they throw it?
xTravel = xNewLoc-xLoc;
yTravel = yNewLoc-yLoc;
// setting the speed of the object depending on
// how far they travelled with it
xInc = xTravel/2;
yInc = yTravel/2;
timePressed = 0;
}
See also
else
ifFrameLoaded
Availability
Flash Player 3. The ifFrameLoaded action was deprecated in Flash 5; Macromedia recommends
using the
MovieClip._framesloaded property.
Usage
ifFrameLoaded([scene,] frame) {
statement(s);
}
Parameters
scene
An optional string specifying the name of the scene that must be loaded.
frame The frame number or frame label that must be loaded before the next statement
is executed.
statement(s) The instructions to execute if the specified scene, or scene and frame,
are loaded.
Returns
Nothing.

Table of Contents

Related product manuals