EasyManua.ls Logo

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

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...
554 Animation, Filters, and Drawings
var lbl:TextField = bevel_mc.createTextField("label_txt", 10, 0,
lineLength + 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 images 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);

Table of Contents

Related product manuals