How to use color transforms in FXG(Graphic)?
The ColorTransform class lets you adjust the color values in a display object. The color adjustment or color transformation can be applied to all four channels: red, green, blue, and alpha transparency. It has various properties for the color adjustment like redMultiplier, greenMultiplier, blueMultiplier, redOffset, greenOffset, blueOffset.
I have created sample FXG file using color transforms. We can also use color transforms in ActionScript.
// FXGData.fxg file
<?xml version="1.0" encoding="utf-8"?> <Graphic xmlns="http://ns.adobe.com/fxg/2008" version="2"> <Group> <Rect height="100" width="200"> <fill> <SolidColor color="#FF0000"/> </fill> <transform> <Transform> <colorTransform> <ColorTransform redMultiplier="0.5" greenMultiplier="1.2" blueMultiplier="1" alphaMultiplier="0.4" redOffset="0" greenOffset="-181" blueOffset="0" alphaOffset="0"/> </colorTransform> </Transform> </transform> </Rect> <Rect height="100" width="200" x="220"> <fill> <SolidColor color="#00FF00"/> </fill> <transform> <Transform> <colorTransform> <ColorTransform redMultiplier="0.5" greenMultiplier="0.2" blueMultiplier="1" alphaMultiplier="0.4" redOffset="0" greenOffset="-50" blueOffset="0" alphaOffset="0.8"/> </colorTransform> </Transform> </transform> </Rect> </Group> </Graphic>
//ApplicationTest.mxml
<?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:local="*"> <local:FXGData x="40" y="40" /> </s:Application>
+