/ Published in: ActionScript 3
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// Please note that the rotation is in radians!To convert from degrees to radians: degrees * Math.PI / 180; var grad:String = GradientType.LINEAR; var linMatrix:Matrix = new Matrix( ); var rotationDegrees:int = 90 linMatrix.createGradientBox( WIDTH, HEIGHT, (rotationDegrees * Math.PI / 180) ); var colors:Array = [ Colors.GRAD_BLACK, Colors.GRAD_LIGHT_BLACK ]; var alphas:Array = [ 1, 0.9 ]; var ratios:Array = [ 0, 255 ]; var focalPoint:Number = .0; graphics.beginGradientFill( grad , colors , alphas , ratios , linMatrix , SpreadMethod.PAD, InterpolationMethod.RGB, focalPoint); graphics.drawRect( 0, 0, WIDTH -4 , HEIGHT); graphics.endFill( );