1 Reply Latest reply on Apr 30, 2010 5:02 AM by David_F57

    Effect in the custom component

    Marant2000

      Hi,

       

      I have following application that works fine:

       

      <?xml version="1.0" encoding="utf-8"?>

      <s:Application (...)>

           <fx:Declarations>

                <s:BlurFilter id="bOn" blurX="8" blurY="8"/>

           </fx:Declarations>

           <mx:Image source="@Embeded('test.png')" filters="{[bOn]}"/>

      </s:Applications>

       

      If I create custom component and put image and filter inside I get run time error "Parameter 0 is of the incorrect type. Should be type Filter".

      Modified code for application:

       

      <?xml version="1.0" encoding="utf-8"?>

      <s:Application (...)>

           <comp:MyComponent/>

      </s:Applications>

       

      and for custom component:

       

      <?xml version="1.0" encoding="utf-8"?>

      <s:HGroup (...)>

           <fx:Declarations>

                <s:BlurFilter id="bOn" blurX="8" blurY="8"/>

           </fx:Declarations>

           <mx:Image source="@Embeded('test.png')" filters="{[bOn]}"/>

      </s:HGroup>

       

      What is the reason?

       

      Regards,

      Marcin

       

       

        • 1. Re: Effect in the custom component
          David_F57 Level 5

          hi,

           

          if you assign the filter in the mxml you don't set it as an array of filters just a list, as per the code below which works fine.

           

          David.

           

           

          <?xml version="1.0" encoding="utf-8"?>

          <s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"

          xmlns:s="library://ns.adobe.com/flex/spark"

          xmlns:mx="library://ns.adobe.com/flex/mx" width="400" height="300">

           

          <fx:Declarations>

          <s:BlurFilter id="bOn" blurX="8" blurY="8"/>

          </fx:Declarations>

           

          <mx:Image id="img" source="@Embed('pizzas.jpg')" filters="{bOn}"/>

          </s:Group>