DisplacementMapFilter (flash.filters.DisplacementMapFilter)
519
import flash.filters.DisplacementMapFilter;
import flash.display.BitmapData;
import flash.geom.Point;
import flash.geom.Matrix;
import flash.geom.ColorTransform;
var mapBitmap:BitmapData = createGradientBitmap(300, 80, 0xFF000000,
"radial");
var mapPoint:Point = new Point(-30, -30);
var componentX:Number = 1;
var componentY:Number = 1;
var scaleX:Number = 10;
var scaleY:Number = 10;
var mode:String = "wrap";
var color:Number = 0x000000;
var alpha:Number = 0x000000;
var filter:DisplacementMapFilter = new DisplacementMapFilter(mapBitmap,
mapPoint, componentX, componentY, scaleX, scaleY, mode, color, alpha);
var txtBlock:MovieClip = createTextBlock();
txtBlock._x = 30;
txtBlock._y = 30;
txtBlock.filters = new Array(filter);
function createGradientBitmap(w:Number, h:Number, bgColor:Number,
type:String, hide:Boolean):BitmapData {
var mc:MovieClip = this.createEmptyMovieClip("mc", 1);
var matrix:Matrix = new Matrix();
matrix.createGradientBox(w, h, 0, 0, 0);
mc.beginGradientFill(type, [0xFF0000, 0x0000FF], [100, 100], [0x55,
0x99], matrix, "pad");
mc.lineTo(w, 0);
mc.lineTo(w, h);
mc.lineTo(0, h);
mc.lineTo(0, 0);
mc.endFill();
(hide == true) ? mc._alpha = 0 : mc._alpha = 100;
var bmp:BitmapData = new BitmapData(w, h, true, bgColor);
bmp.draw(mc, new Matrix(), new ColorTransform(), "normal",
bmp.rectangle, true);
mc.attachBitmap(bmp, this.getNextHighestDepth());
return bmp;
}
Summary of Contents for FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
Page 1: ...ActionScript 2 0 Language Reference ...
Page 1352: ...1352 ActionScript classes ...