7 Replies Latest reply on Jan 13, 2010 10:16 PM by ehusar

    Add/RemoveChild on Custom Components?

    ehusar

      I am using a custom reflection component and want the ability to add and remove it as the user wishes.  If you look at this screen shot you can see the reflection on the red and blue boxes at the bottom.

       

      Picture 1.png

       

      The effect is added like this and must follows each Canvan I am applying it to.

       

      ...

      </mx:Canvas>

      <reflector:Reflector id="myReflector1" target="{riderOneBox}" alpha=".5" falloff=".60" blurAmount=".60"/>

       

      Up in the :WindowedApplication it requires the following.

       

      <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml"
         ...
          xmlns:reflector="com.rictus.reflector.*"
         ...

           >

       

      I was hoping I could simple do a RemoveChild(myReflection1);.  But that doesn't seem to be the case.  When I do this I get an error that say the following...

       

      TypeError: Error #1034: Type Coercion failed: cannot convert com.rictus.reflector::Reflector@1c9e03c1 to mx.states.RemoveChild.

       

      I am sure this is possible but I guess I just don't understand the relactionship of the reflection component when it is rendered on the screen.  I could just update the alpha to remove it. That would be easy but I would like to actaully removeChild on it if possible.

       

      Any ideas?