/ Published in: ActionScript 3
This snippet is for when you need to adjust the colours of a display object on the fly using code. It's the equivalent of using the "Adjust Color" filter on a MovieClip.
Expand |
Embed | Plain Text
import fl.motion.AdjustColor; import flash.filters.ColorMatrixFilter; var colorFilter:AdjustColor = new AdjustColor(); var mColorMatrix:ColorMatrixFilter; var mMatrix:Array = []; var MC:MovieClip = new MovieClip(); function adjustColors():void { //all 4 must contain a value of an integer, if one is not set, it will not work colorFilter.hue = 50; colorFilter.saturation = 50; colorFilter.brightness = 50; colorFilter.contrast = 0; mMatrix = colorFilter.CalculateFinalFlatArray(); mColorMatrix = new ColorMatrixFilter(mMatrix); MC.filters = [mColorMatrix]; }
You need to login to post a comment.
