ropo
ropo

Reputation: 1496

ArgumentError: Error #2005: Parameter 0 is of the incorrect type. Should be type Filter

And my code is really simple:

date = new StyleableTextField();
date.filters = [new DropShadowFilter(1,90,0xffffff)];

What is wrong? This is crazy

Ok, I think this need more information: I am doing this in an item renderer (extends LabelItemRenderer). The method is override protected function createChildren():void

Maybe I have to call set filters later?

Upvotes: 1

Views: 1267

Answers (1)

dejjub-AIS
dejjub-AIS

Reputation: 1541

ropo is right

This happend with me also.

I first have applied the GlowFilter to the UIComponent which requires spark.filters.GlowFilter

Then I changed the code and applied to Sprite which requires flash.filters.GlowFilter

Since GlowFilter was already imported, the FlashBuilder did not throw any compile error but it throwed the error in the run-time.

So just make sure if applying filters to Flex component then import

  spark.filters.*

and for the non-flex

  flash.filters.*

Also, just in case if somene wants to apply filters to both flex and flash components use fully qualified name

  flexComp.filters = [new spark.filters.DropShadowFilter(1,90,0xffffff)];
  flashComp.filters = [new flash.filters.DropShadowFilter(1,90,0xffffff)];

Upvotes: 1

Related Questions