[HTML5] set shadow on a sprite

Hi guys.

I’m trying to set an outer shadow on a sprite. I have tried to use the DropShadowFilter class, but with html5 target not work.
There is another method for set this outer shadow without use the DropShadowFilter class?


If the sprite never changes, you could draw it to a bitmap. If I recall correctly, BitmapData.draw() supports filters even on HTML5. And even if I’m wrong about that, you could still make a shadow by manipulating the pixels.

However, don’t do this if your sprite has moving parts. draw() isn’t very efficient in HTML5, so you don’t want to call it often. In the case of moving parts, try making a bitmap shadow for each one, and move the shadow along with the part. It isn’t pretty, but at least you won’t have to update the bitmaps once they’re drawn.

Hi player.

The sprite contain a dynamic text, so i think i can’t do what you have say.

For text’s shadow you could duplicate the textfield, move it behind the main text, set it’s alpha to something lower than 1 and color to black. Then update it’s position relative to main text and add a small offset.

It’s a really bad solution :frowning2: but i need the shadow effect for it.

when the problem with DropShadowFilter will corrected?