
516
ActionScript classes
componentY (DisplacementMapFilter.componentY
property)
public componentY : Number
Describes which color channel to use in the map image to displace the
y
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
componentY
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.componentY = 4;
this.filters = new Array(filter);
}
function createDisplacementMapRectangle():MovieClip {
var mapBitmap:BitmapData = createGradientBitmap(300, 80, 0xFF000000,
"radial");
var filter:DisplacementMapFilter = new DisplacementMapFilter(mapBitmap,
new Point(-30, -30), 1, 1, 10, 10, "wrap", 0x000000, 0x000000);
var txtBlock:MovieClip = createTextBlock();
txtBlock._x = 30;
txtBlock._y = 30;
txtBlock.filters = new Array(filter);
return txtBlock;
}
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);
Содержание FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
Страница 1: ...ActionScript 2 0 Language Reference ...
Страница 1352: ...1352 ActionScript classes ...