EasyManua.ls Logo

MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH - Page 578

MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH
830 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...
578 Creating Interaction with ActionScript
5. Select Control > Test Movie, and drag the movie clip to test the collision detection.
Whenever the bounding box of the car intersects the bounding box of the area, the
status is
true.
For more information, see hitTest (MovieClip.hitTest method) in the ActionScript 2.0
Language Reference.
Creating a simple line drawing tool
You can use methods of the MovieClip class to draw lines and fills on the Stage as the SWF
file plays. This lets you create drawing tools for users and draw shapes in the SWF file in
response to events. The drawing methods are
beginFill(), beginGradientFill(),
clear(), curveTo(), endFill(), lineTo(), lineStyle(), and moveTo().
You can apply these methods to any movie clip instance (for example,
myClip.lineTo()), or
to a level (
_level0.curveTo()).
The
lineTo() and curveTo() methods let you draw lines and curves, respectively. You
specify a line color, thickness, and alpha setting for a line or curve with the
lineStyle()
method. The
moveTo() drawing method sets the current drawing position to the x and y
Stage coordinates that you specify.
The
beginFill() and beginGradientFill() methods fill a closed path with a solid or
gradient fill, respectively, and
endFill() applies the fill specified in the last call to
beginFill() or beginGradientFill(). The clear() method erases whats been drawn in
the specified movie clip object.
To create a simple line drawing tool:
1. In a new document, create a button on the Stage, and enter clear_btn as the instance
name in the Property inspector.
2. Select Frame 1 in the Timeline.
3. Select Window > Actions to open the Actions panel, if it is not already visible.

Table of Contents

Related product manuals