3 Replies Latest reply on Jun 26, 2012 8:59 AM by Ned Murphy

    Assigning filters in the constructor breaks keyframe animation?


      Dear community


      I'm having a strange issue and I cannot pinpoint the problem here.

      I have a subclass of MovieClip which assigns some filters in the constructor. Something like this:


      public class MyMovieClip extends MovieClip
          public function MyMovieClip()
              filters = [new DropShadowFilter(2, 45, 0, 0.75, 4, 4)];


      Then I created some Symbols in my Library and assigned "MyMovieClip" as their base-class. So when I place these Symbols on the stage and test my movie, they get the shadow-filter applied, just as I wanted.


      But if I try to animate these Symbols (no matter if it's motion-tween or classical-tween), they won't move at all. They will freeze at the first frame (the timeline is actually played and animations work, but not for the symbols with the filter). If I remove the line with the filters from the constructor, it animates normally. It also doesn't work if I assign the filter every frame (eg. on ENTER_FRAME).


      Important: I know that I could add a shadow-filter in the Flash IDE instead of doing it in code, and that this would work for animations as well. But this is just a simplified example, because in the end I would like to add a custom shader (Pixel Bender) to my symbols instead of the shadow filter... and these can only be added in code.


      This is Flash CS6 btw. I'm not sure if this worked in previous versions of flash or not.