2 Replies Latest reply on Aug 28, 2010 12:36 PM by Francisc

    Black and White Filter

    Francisc Level 3



      Is there anyway to apply a black and white filter over all the elements of a Group in Flex 4, please?

        • 1. Re: Black and White Filter
          ShardulSingh Level 3


          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:ColorMatrixFilter id="cmf" matrix="{bwMatrix}" />



          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"






                         minWidth="955" minHeight="600">






                      private var r:Number = 0.2225;


                      private var g:Number = 0.7169;


                      private var b:Number = 0.0606;






                      private var bwMatrix:Array = [r, g, b, 0, 0,


                          r, g, b, 0, 0,


                          r, g, b, 0, 0,


                          0, 0, 0, 1, 0];










                  <!-- Place non-visual elements (e.g., services, value objects) here -->










          <mx:VBox width="800" height="600" borderStyle="solid" horizontalAlign="center" verticalAlign="middle">






                          <s:ColorMatrixFilter id="cmf" matrix="{bwMatrix}" />






                              <s:Label text="Spark Label" color="0xFF0000"/>   


                              <s:Button label="Spark button" color="0xFF0000"/>


                              <s:TextArea text="Text area of spark" color="0xFF0000"/>














          with Regards,


          Shardul Singh Bartwal

          • 2. Re: Black and White Filter
            Francisc Level 3