EasyManua.ls Logo

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

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...
502 Animation, Filters, and Drawings
To modify a filter’s properties when applied to a movie clip instance:
1. Create a new Flash document and save the file as modifyFilter.fla.
2. Add the following ActionScript to Frame 1 of the Timeline:
this.createEmptyMovieClip("my_mc", 10);
// draw square
with (my_mc) {
beginFill(0xFF0000, 100);
moveTo(0, 0);
lineTo(100, 0);
lineTo(100, 100);
lineTo(0, 100);
lineTo(0, 0);
endFill();
}
my_mc._x = 100;
my_mc._y = 100;
// use default DropShadowFilter values
my_mc.filters = [new flash.filters.DropShadowFilter()];
trace(my_mc.filters[0].distance); // 4
var filter_array:Array = my_mc.filters;
filter_array[0].distance = 10;
my_mc.filters = filter_array;
trace(my_mc.filters[0].distance); // 10
The first section of this code uses the Drawing API to create a red square, and positions
the shape on the Stage. The second section of code applies a drop shadow filter to the
square. Next, the code creates a temporary array to hold the current filters to apply to the
red square on the Stage. The
distance property of the first filter is set to 10 pixels, and
the modified filter is reapplied to the
my_mc movie clip instance.
3. Select Control > Test Movie to test the document.
NOTE
Currently, no support is available for having any filters perform rotation based upon
their parent’s rotation or some sort of other rotation. The blur filter always blurs
perfectly horizontally or vertically, independently of the rotation or skew of any item
in the parent object tree.
TIP
Filtered content has the same restrictions on size as content with its cacheAsBitmap
property set to
true. If the author zooms in too far on the SWF file, the filters are no
longer visible when the bitmap representation is greater than 2880 pixels in either
direction. When you publish SWF files with filters, it is a good idea to disable the
zoom menu options.

Table of Contents

Related product manuals