2 Replies Latest reply on Jul 25, 2006 2:07 PM by shogo2040

    Adjust the brightness for an Image object

      How do I use the ColorUtil.adjustBrightness for just this image in the function.

      If this cannot be used for just the image, then how can I use filters to make the image brighter?

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="horizontal">
      import mx.controls.Image;

      private function applyBrighterImage(imageSource:Image):void {

      var brighterImage:Image = new Image();

      brighterImage.source = imageSource.source;

      //help me.. How do I make brighterImage brighter?
        • 1. Re: Adjust the brightness for an Image object
          Ray Greenwell
          You can use a ColorTransform to adjust the colors in any DisplayObject. If you want to actually make a copy of the Image that is brighter, you'll probably want to set the new ColorTransform, draw the image into a BitmapData, then re-set whatever the old ColorTransform was.
          • 2. Re: Adjust the brightness for an Image object
            Level 1
            Thanks for the suggestion! However, after several hours, I did it like this:

            private function createBrightnessFilter():ColorMatrixFilter {
            //brightness filter using cryptic matrix I googled for. A knowledge of matrices is needed.
            var matrix:Array = new Array(1,0,0,0,80,
            0,1,0,0,80 ,
            0,0,1,0,80 ,
            0,0,0,1,0 );
            var brightnessFilter:ColorMatrixFilter = new ColorMatrixFilter(matrix);

            return brightnessFilter;

            Anywhoo.. whoever reads this.. reply to me if this works for you too.