Skip navigation
Currently Being Moderated

Assigning filters in the constructor breaks keyframe animation?

Jun 26, 2012 6:59 AM

Tags: #actionscript #animation #tween #filters #keyframe

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.

  • Currently Being Moderated
    Jun 26, 2012 7:48 AM   in reply to GiantRobotKitten

    When you do timeline tweening, it is pretty much hands off as far as interupting them goes.  If you change anything about what the timeline has written in stone, you break the tween.  If you use coded tweening you should not have this problem.

    Mark as:
  • Currently Being Moderated
    Jun 26, 2012 8:59 AM   in reply to GiantRobotKitten

    As I just said, when you build a tween into a timeline, it is written in stone in the file when you compile, and anything you do to change what it has memorized will break that tween.  You seem to already know all of the options available to you, so you just need to pick one.  Not all things are destined to be do-able by non-tech-savvy folks.

    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points