Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Very possible to do with a ColorMatrixFilter, by building the matrix with a 255 offset on the red channel (but an identity matrix otherwise).</p> <p>This sample Document class assumes the FLA library has a 720 x 480 exported symbol "GradientBMD" which is a flash.display.BitmapData subclass:</p> <pre><code>package { import flash.display.Sprite; import flash.display.Bitmap; import flash.display.BitmapData; import flash.geom.Point; import flash.filters.*; public class GreyscaleDemo extends Sprite { public function GreyscaleDemo() { var bmd:BitmapData = new GradientBMD(720,480); var matrix:Array = new Array(); matrix = matrix.concat([1,0,0,0,255]); matrix = matrix.concat([0,1,0,0,0]); matrix = matrix.concat([0,0,1,0,0]); matrix = matrix.concat([0,0,0,1,0]); var colorFilter:ColorMatrixFilter = new ColorMatrixFilter(matrix); bmd.applyFilter(bmd, bmd.rect, new Point(0,0), colorFilter); var bitmap:Bitmap = new Bitmap(bmd); this.addChild(bitmap); } } } </code></pre> <p>You could also create a new bitmapData filled with the color you want the gradient to ramp to (in place of black) and copy it into your gradient with BlendMode.ADD:</p> <pre><code>package { import flash.display.Sprite; import flash.display.Bitmap; import flash.display.BitmapData; import flash.display.BlendMode; import flash.geom.Point; public class GreyscaleDemo extends Sprite { public function GreyscaleDemo() { var bmd:BitmapData = new GradientBMD(720,480); var bitmap:Bitmap = new Bitmap(bmd); this.addChild(bitmap); var bmd2:BitmapData = new BitmapData(720, 480, false, 0xFF0000); bmd.draw(bmd2, null, null, BlendMode.ADD, bmd.rect,false); } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload