Thursday, 3 June 2010

Gradient Masks in Flash

So I wanted to create some focal blur in flash using the same technique that I would use in Photoshop. i.e. duplicate the image, blur the top layer and mask it off with a radial gradient.

Flash utilises layers and blur so I thought this would be easy. Unfortunately after trying it didn't work! It just masked off the box with the gradient mask in it. Doh!

After some reading it turns out you need to put one line of action script in for this to work. So, say I have two objects, a gradient and a box (named as their instance names and as the layer names as well. I'm not sure which name it uses?). I first applied the mask, then made a new layer and put a line of actionscript which said:

box.mask = gradient;

Maybe you need to make the layer the mask in the UI, i'm not sure. But fiddle a bit and it should work.

Found most of the solution on this page -

Go to the section with the gradient thing quite a ways' down.

No comments:

Post a Comment