Flash CS3 Documentation |
|||
| ActionScript 2.0 Language Reference > ActionScript classes > Matrix (flash.geom.Matrix) > createGradientBox (Matrix.createGradientBox method) | |||
public createGradientBox(width:Number, height:Number, [rotation:Number], [tx:Number], [ty:Number]) : Void
Creates the specific style of matrix expected by the MovieClip.beginGradientFill() method. Width and height are scaled to a scaleX/scaleY pair and the tx/ty values are offset by half the width and height.
Availability: ActionScript 1.0; Flash Player 8
width:Number - The width of the gradient box.
height:Number - The height of the gradient box.
rotation:Number [optional] - The amount to rotate, in radians. The default value is 0.
tx:Number [optional] - The distance in pixels to translate to the right along the x axis. This value will be offset by half of the width parameter. The default value is 0.
ty:Number [optional] - The distance in pixels to translate down along the y axis. This value will be offset by half of the height parameter. The default value is 0.
The following example uses myMatrix as a parameter for the MovieClip object's beginGradientFill() method.
import flash.geom.Matrix;
var myMatrix:Matrix = new Matrix();
trace(myMatrix.toString()); // (a=1, b=0, c=0, d=1, tx=0, ty=0)
myMatrix.createGradientBox(200, 200, 0, 50, 50);
trace(myMatrix.toString()); // (a=0.1220703125, b=0, c=0, d=0.1220703125, tx=150, ty=150)
var depth:Number = this.getNextHighestDepth();
var mc:MovieClip = this.createEmptyMovieClip("mc_" + depth, depth);
var colors:Array = [0xFF0000, 0x0000FF];
var alphas:Array = [100, 100];
var ratios:Array = [0, 0xFF];
mc.beginGradientFill("linear", colors, alphas, ratios, myMatrix);
mc.lineTo(0, 300);
mc.lineTo(300, 300);
mc.lineTo(300, 0);
mc.lineTo(0, 0);
beginGradientFill (MovieClip.beginGradientFill method)
Flash CS3
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flash/9.0/main/00001850.html