1 Reply Latest reply on Dec 20, 2010 8:49 AM by FM_Flame

    [Flex 4] AnimateFilter - how to animate showing of a dropShadow?

    FM_Flame Level 1

      I want to add a dropshadow to a group with a nice fade animation, and something as simple as that gives me a lot of trouble, can someone give me and example ?


      What I try to do is with AS, although I tried with MXML and I have the same bad result. Here's my code:


      var dropShadowFilter:DropShadowFilter = new DropShadowFilter(2,90,0x000000,0,5,5,1.5,3);

      contentBg.filters = [dropShadowFilter];

      var animateFilter:AnimateFilter = new AnimateFilter();

      animateFilter.bitmapFilter = dropShadowFilter;

      animateFilter.duration = 1000;

      var smp:SimpleMotionPath = new SimpleMotionPath("alpha",0,0.4);

      animateFilter.motionPaths = Vector.<MotionPath>([smp]);




      All I want is the defined drop shadow to fade from alpha 0 to alpha 0.4 in 1000 ms on the contentBg group.


      At the moment I see some very glitched animation, where the drop shadows goes from 0 alpha to some point where it's kinda darker than expected and suddenly it jumps back to more faded but still visible ?!!?


      I have no idea I am doing something wrong, I will post an example if noone can help me out that have already managed to make this work. Thanks!



        • 1. Re: [Flex 4] AnimateFilter - how to animate showing of a dropShadow?
          FM_Flame Level 1

          Ok it was really stupid... I thought that the animateFilter would add the filter and animate it. But it turned out that it only adds it for the period of animation and there's no option to keep it. So the only thing I had to change it my code was on the EffectEnd to add the filter to my group, not before the animation and that's it.


          Still seams weird that If I already have filter on my group it doesn't animate it, but adds one more filter and animates it. So you have 2 dropShadows in my case, one static and one animated....


          Anyway the question is solved. If someone can add something, you're welcome.