MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH Manual page 532

Learning actionscript 2.0 in flash
Table of Contents

Advertisement

Moving the mouse pointer along the
Moving the mouse pointer along the
closer the mouse pointer is to the upper-left corner of the Stage, the less blurring is applied
to the movie clip.
Animating a filter by using ActionScript
You can use ActionScript, such as the Tween class, to animate filters at runtime, which lets
you apply interesting, animated effects to your Flash applications.
In the following example, you see how to combine the BlurFilter with the Tween class to
create an animated blur that modifies the Blur filter between a value of 0 and 10 at runtime.
To animate blurs using the Tween class:
1.
Create a new Flash document and save it as animatedfilter.fla.
2.
Add the following ActionScript to Frame 1 of the Timeline:
import flash.filters.BlurFilter;
import mx.transitions.Tween;
import mx.transitions.easing.*;
this.createEmptyMovieClip("holder_mc", 10);
holder_mc.createEmptyMovieClip("img_mc", 20);
var mclListener:Object = new Object();
mclListener.onLoadInit = function(target_mc:MovieClip) {
target_mc._x = (Stage.width - target_mc._width) / 2;
target_mc._y = (Stage.height - target_mc._height) / 2;
var myTween:Tween = new Tween(target_mc, "blur", Strong.easeInOut, 0,
20, 3, true);
myTween.onMotionChanged = function() {
target_mc._parent.filters = [new BlurFilter(target_mc.blur,
target_mc.blur, 1)];
};
myTween.onMotionFinished = function() {
myTween.yoyo();
}
};
var my_mcl:MovieClipLoader = new MovieClipLoader();
my_mcl.addListener(mclListener);
my_mcl.loadClip("http://www.helpexamples.com/flash/images/image1.jpg",
holder_mc.img_mc);
532
Animation, Filters, and Drawings
-axis modifies the blur filter's
x
-axis modifies the blur filter's
y
property.
blurX
property. The
blurY

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Flash 8

Table of Contents