• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Clearing a filter

New Here ,
May 02, 2009 May 02, 2009

Copy link to clipboard

Copied

This is one of those things that drives me nutty as it seems like it should be obvious but I've spent the last 30 minutes searching for an answer and have come up empty.

How do I clear a filter after having applied it to an object. In particular, I'm bluring an object while animating it but want to clear the blur once it's hit the destination mark.

It's being applied via:

[object_in_question].filters = [BlurAmount];

TOPICS
ActionScript

Views

658

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , May 02, 2009 May 02, 2009
Although setting it to null would remove all filters, sometimes you only want to remove the temporary filter. The filters are an array, so if you wanted to have a drop shadow all the time, and a blur sometimes, you could do this kind of thing:
var stationaryFilters:Array = [dropshadowfilter];
var movingFilters:Array = [dropshadowfilter,blurfilter];
where the two entries are filters you've already set up. Then when you move, you would say:
mc.filters = movingFilters;
and when you stop you say:
mc
...

Votes

Translate

Translate
Community Expert ,
May 02, 2009 May 02, 2009

Copy link to clipboard

Copied

assign it to null.

[object_in_question].filters = null;

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 02, 2009 May 02, 2009

Copy link to clipboard

Copied

Although setting it to null would remove all filters, sometimes you only want to remove the temporary filter. The filters are an array, so if you wanted to have a drop shadow all the time, and a blur sometimes, you could do this kind of thing:
var stationaryFilters:Array = [dropshadowfilter];
var movingFilters:Array = [dropshadowfilter,blurfilter];
where the two entries are filters you've already set up. Then when you move, you would say:
mc.filters = movingFilters;
and when you stop you say:
mc.filters = stationaryFilters;
So, thinking in terms of it all being an array, I would tend to say:
mc.filters = [];
rather than
mc.filters = null;
even if the two would both remove all filters.
Another trick to think about is that you could manually set up a complex set of filters on a movieclip on the stage, until you like the look of it, and then when you want another movieclip to have the same effects, you could say:
mc.filters = fancyStageMC.filters;
and all of the values would take effect immediately. Working this way means you can get the look that you like without having to spend a while trying all sorts of parameters in your code.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 02, 2009 May 02, 2009

Copy link to clipboard

Copied

LATEST

Dang, just didn't have the array mindset going when I was trying to clear the filters, even though I needed that mindest when I was applying the darn thing.

Thanks guys, man I love this forum!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines