Sunday, April 4, 2010

Trying to draw shadow on drawn object

I am drawing an object dynamically using the handful of
drawing commands in the Graphics library (drawCircle, drawRect,
curveTo, etc). I end up creating an enclosed object that I fill in
with beginFill. I would like to add a drop shadow but the object
does not end up being a rectangle so I can't use
RectangularDropShadow. Is it possible to do what I am trying to do?
Any ideas?



Thanks in advance,



ToddTrying to draw shadow on drawn object
Yes you drop shadow filter.

How? not sure. But, I know for sure this is possible using
the filter.



Thanks,Trying to draw shadow on drawn object
If the object into which you are drawing has a filters
property, then you can do this:



import flash.filters.*;



canvas.filters = [ new DropShadowFilter() ]; // this is an
array of filters, here it is just an array of 1 element



Assuming you are drawing into a Canvas. If the Canvas does
not have a solid background then the shadow will be applied to all
of its children.



The DropShadowFilter takes a number of arguments, all of
which default to a standard shadow. Check the Flex docs on this
class.

No comments:

Post a Comment