The
Creates a new Flash document and saves it as a adjustfilter.fla.
Add the following ActionScript to frame 1th of the timeline: import Flash.filters.BlurFilter;
code is as follows |
copy code |
This.createemptymovieclip (" HOLDER_MC "); Holder_ Mc.createemptymovieclip ("IMG_MC", 20); Holder_mc.img_mc.loadMovie ("/images/image2.jpg"); Holder_mc.filters = [New Blurfilter (10, 10, 2)]; holder_mc._x = 75; holder_mc._y = n; Holder_mc.onmousemove = function () { var tempfilter:blurfilter = holder_mc.filters[0]; & nbsp; Tempfilter.blurx = Math.floor ((_xmouse/stage.width) * 255); Tempfilter.blury = Math.floor ((_ymouse/stage.height) * 255); holder_mc.filters = [Tempfilter]; }; |
The preceding code is divided into three parts. The first section imports the Flash.filters.BlurFilter class, so that you do not need to use the fully qualified class name when referencing the Blurfilter class. The second part of the code creates some movie clips and loads the images into a nested clip. The third part of the code responds to the mouse movement on the stage and adjusts the blur effect accordingly.
Select Control > Test movie to test the Flash document.