MACROMEDIA FLASH MX 2004-USING ACTIONSCRIPT IN FLASH Use Manual page 196

Using actionscript in flash
Hide thumbs Also See for FLASH MX 2004-USING ACTIONSCRIPT IN FLASH:
Table of Contents

Advertisement

if (zapped) {
bug_mc._y += 25;
}
};
The bug's instance name is
the bug is referred to as
refers to the object that contains it.
There are event handlers with several different events:
The event handlers are defined on Frame 1 after the SWF file loads. The actions in the
onEnterFrame()
frame SWF file, the playhead still enters that frame repeatedly and the script executes repeatedly.
Two variables,
initx
movie clip instance. A function is defined and assigned to the
instance. This function is called each time the mouse button is pressed and released
reset_btn
on the
reset_btn
Stage, resets its rotation and alpha values, and resets the
A conditional
if
touching the outlet instance (
the evaluation,
true
If the
hitTest()
variable is set to
is told to play.
If the
hitTest()
immediately following the
The actions in the
instance. The actions in the
bug_mc
released over the
The
startDrag()
instance, the keyword
bug_mc.onPress = function() {
this.startDrag();
};
The
stopDrag()
bug_mc.onRelease = function() {
this.stopDrag();
};
To watch the SWF file play, see this section in Using ActionScript Help in Flash.
196
Chapter 6: Creating Interaction with ActionScript
, and the outlet's instance name is
bug_mc
because the script is attached to the bug and the reserved word
this
event handler executes every time the playhead enters a frame. Even in a one-
and
, are defined to store the initial x and y positions of the
inity
button. The function places the ladybug back in its starting position on the
statement uses the
hitTest()
this._parent.zapper_mc
or
:
false
method returns
true
, the alpha and rotation properties are changed, and the
true
method returns
false
statement runs.
if
statement execute when the mouse button is pressed over the
onPress()
onRelease()
instance.
bug_mc
action lets you drag the ladybug. Because the script is attached to the
indicates that it is the
this
action stops the drag action:
onRelease
onRelease
zapped
method to check whether the bug instance is
). There are two possible outcomes of
, the
method is called, the
stopDrag()
, none of the code within the curly braces (
statement execute when the mouse button is
instance that is draggable:
bug
. In the script,
zapper_mc
,
, and
onPress
enterFrame
event handler of the
variable to
.
false
zapper_mc
zapped
this
.
bug_mc
instance
)
{}
bug_mc

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH MX 2004-USING ACTIONSCRIPT IN FLASH and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash mx 2004 - actionscript

Table of Contents