Hello!
Is there anyway to apply a black and white filter over all the elements of a Group in Flex 4, please?
Hi,
below is the solution for you problem.Origionally all spark componets are having their label and text in red color.
But when you added these three lines inside the spark group all the elements becomes Black and White.
<s:filters>
<s:ColorMatrixFilter id="cmf" matrix="{bwMatrix}" />
</s:filters>
So If you want to see them in origional color then comment these three lines.
Hope you will like it. Let me know if you have any issue.Below is code.
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
minWidth="955" minHeight="600">
<fx:Script>
<![CDATA[
private var r:Number = 0.2225;
private var g:Number = 0.7169;
private var b:Number = 0.0606;
[Bindable]
private var bwMatrix:Array = [r, g, b, 0, 0,
r, g, b, 0, 0,
r, g, b, 0, 0,
0, 0, 0, 1, 0];
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<mx:VBox width="800" height="600" borderStyle="solid" horizontalAlign="center" verticalAlign="middle">
<s:Group>
<s:filters>
<s:ColorMatrixFilter id="cmf" matrix="{bwMatrix}" />
</s:filters>
<s:VGroup>
<s:Label text="Spark Label" color="0xFF0000"/>
<s:Button label="Spark button" color="0xFF0000"/>
<s:TextArea text="Text area of spark" color="0xFF0000"/>
</s:VGroup>
</s:Group>
</mx:VBox>
</s:Application>
with Regards,
Shardul Singh Bartwal
North America
Europe, Middle East and Africa
Asia Pacific