554
Animation, Filters, and Drawings
var lbl:TextField = bevel_mc.createTextField("label_txt", 10, 0,
line 20, lineLength, 20);
lbl.autoSize = "center";
lbl.text = "bevel";
Flash uses the Drawing API to draw three triangles on the Stage. Each triangle has a
different value for its joint style.
3.
Save the Flash document and select Control > Test Movie to test the document.
Setting line miter (miterLimit)
The
miterLimit
property is a numerical value that indicates the limit at which a miter joint
(see
“Setting line caps (capsStyle) and joints (jointStyle)” on page 551
) is cut off. The
miterLimit
value is a general multiplier of a stroke. For example, with a value of 2.5,
miterLimit
is cut off at 2.5 times the stroke size. Valid values range from 0 to 255 (if a value
for
miterLimit
is
undefined
, the default value is
3
). The
miterLimit
property is only used
if
jointStyle
is set to
miter
.
Using Drawing API methods and scripting animation
You can combine the Drawing API with the Tween and TransitionManager classes to create
some excellent animated results, and you only have to write a small amount of ActionScript.
The following procedure loads a JPEG image and dynamically masks the image so you can
reveal the image slowly after it loads by tweening the image’s mask.
To animate dynamic masks:
1.
Create a new Flash document and save it as
dynmask.fla
.
2.
Add the following ActionScript to Frame 1 of the Timeline:
import mx.transitions.Tween;
import mx.transitions.easing.*;
var mclListener:Object = new Object();
mclListener.onLoadInit = function(target_mc:MovieClip) {
target_mc._visible = false;
// Center the image on the Stage.
target_mc._x = (Stage.width - target_mc._width) / 2;
target_mc._y = (Stage.height - target_mc._height) / 2;
var maskClip:MovieClip = target_mc.createEmptyMovieClip("mask_mc",
20);
with (maskClip) {
// Draw a mask that is the same size as the loaded image.
beginFill(0xFF00FF, 100);
moveTo(0, 0);
lineTo(target_mc._width, 0);
lineTo(target_mc._width, target_mc._height);
Summary of Contents for FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH
Page 1: ...Learning ActionScript 2 0 in Flash...
Page 8: ...8 Contents...
Page 18: ...18 Introduction...
Page 30: ...30 What s New in Flash 8 ActionScript...
Page 66: ...66 Writing and Editing ActionScript 2 0...
Page 328: ...328 Interfaces...
Page 350: ...350 Handling Events...
Page 590: ...590 Creating Interaction with ActionScript...
Page 710: ...710 Understanding Security...
Page 730: ...730 Debugging Applications...
Page 780: ...780 Deprecated Flash 4 operators...
Page 830: ...830 Index...