514
ActionScript classes
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;
}
function createTextBlock():MovieClip {
var txtBlock:MovieClip = this.createEmptyMovieClip("txtBlock",
this.getNextHighestDepth());
txtBlock.createTextField("txt", this.getNextHighestDepth(), 0, 0, 300,
80);
txtBlock.txt.text = "watch the text bend with the displacement map";
return txtBlock;
}
componentX (DisplacementMapFilter.componentX
property)
public componentX : Number
Describes which color channel to use in the map image to displace the
x
result. Possible values
are 1 (red), 2 (green), 4 (blue), and 8 (alpha).
Availability:
ActionScript 1.0; Flash Player 8
Example
The following example changes the
componentX
property on the existing MovieClip
filteredMc
when a user clicks it. The value changes from 1 to 4, which changes the color
channel from red to blue.
import flash.filters.DisplacementMapFilter;
import flash.display.BitmapData;
import flash.geom.Point;
import flash.geom.Matrix;
import flash.geom.ColorTransform;
var filteredMc:MovieClip = createDisplacementMapRectangle();
filteredMc.onPress = function() {
var filter:DisplacementMapFilter = this.filters[0];
filter.componentX = 4;
this.filters = new Array(filter);
}
Summary of Contents for FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
Page 1: ...ActionScript 2 0 Language Reference ...
Page 1352: ...1352 ActionScript classes ...