ProblemYou want to adjust the contrast of a display object. SolutionUse a contrast matrix and apply it with a ColorMatrixFilter object. DiscussionAs mentioned in Recipe 10.13, you can adjust the brightness by either scaling or offsetting color values. You can change contrast by both scaling and offsetting color values at the same time. The following matrix describes a generic contrast matrix: a 0 0 0 b 0 a 0 0 b 0 0 a 0 b 0 0 0 1 0 You can calculate the scale and offset values from one contrast value by using the following equations: a = value * 11 b = 63.5 (value * 698.5) You can use the ascb.filters.ColorMatrixArrays.getContrastArray( ) method to construct a contrast array given the contrast value. The effective range for the contrast value is from 0 to 1: sampleSprite.filters = [new ColorMatrixFilter(ColorMatrixArrays.getContrastArray(1))]; See AlsoRecipe 10.13 |