EasyManua.ls Logo

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

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...
Drawing with ActionScript 555
lineTo(0, target_mc._height);
lineTo(0, 0);
endFill();
}
target_mc.setMask(maskClip);
target_mc._visible = true;
var mask_tween:Object = new Tween(maskClip, "_yscale", Strong.easeOut,
0, 100, 2, true);
};
this.createEmptyMovieClip("img_mc", 10);
var img_mcl:MovieClipLoader = new MovieClipLoader();
img_mcl.addListener(mclListener);
img_mcl.loadClip("http://www.helpexamples.com/flash/images/image1.jpg",
img_mc);
This code example imports the Tween class and each of the classes in the easing package.
Next, it creates an object that acts as the listener object for a MovieClipLoader instance
that’s created in a later section of the code. The listener object defines a single event
listener,
onLoadInit, which centers the dynamically loaded JPEG image on the Stage.
After the code repositions the image, a new movie clip instance is created within the
target_mc movie clip (which contains the dynamically loaded JPEG image). The
Drawing API code draws a rectangle with the same dimensions as the JPEG image within
this new movie clip. The new movie clip masks the JPEG image by calling the
MovieClip.setMask() method. After the mask is drawn and set up, the mask uses the
Tween class to animate, which causes the image to slowly reveal itself.
3. Save the Flash document and select Control > Test Movie to test the SWF file.
You can find a sample source file, drawingapi.fla, in the Samples folder on your hard disk,
which shows you how to use the Drawing API in a Flash application.
In Windows, browse to boot drive\Program Files\Macromedia\Flash 8\Samples and
Tutorials\Samples\ActionScript\DrawingAPI.
On the Macintosh, browse to Macintosh HD/Applications/Macromedia Flash 8/Samples
and Tutorials/Samples/ActionScript/DrawingAPI.
NOTE
To animate _alpha in the previous example instead of _yscale, tween the target_mc
directly instead of the mask movie clip.

Table of Contents

Related product manuals