开发者

Flex 3 and scaling DropShadowFilter

开发者 https://www.devze.com 2022-12-10 04:59 出处:网络
I have an application that requires resizing of a component that will be scaled up and down quite frequently. I noticed that when I scale the component, any filter I use on it will not scale with it.

I have an application that requires resizing of a component that will be scaled up and down quite frequently. I noticed that when I scale the component, any filter I use on it will not scale with it. I realize this makes sense, but I was wondering if Flex had a tool bu开发者_开发知识库ilt in that would allow me to scale the filter with the component. I know I can write some actionscript on a custom component and change the scale of the filter properties based off of the component's current scale... Any suggestions?


if you define the filters in mxml they should scale automatically.

<mx:Canvas width="300" height="300">
  <mx:filters>
    <mx:DropShadowFilter />
  </mx:filters>
</mx:Canvas>

That should produce a canvas that has a basic drop shadow regardless of its size. heres a link to the docs on the various filters: http://livedocs.adobe.com/flex/3/langref/flash/filters/package-detail.html


My suggestion would be to work with a resizing (allowScale=true, maintaintAspectRatio=false) <mx:Image> PNG 24 with the shadow in it.

You will save CPU and have much better control on it (you're only adding 5-10KB tops).

The dropshadowfilter class was definitely never designed to be animated.

Hope this helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消