Gradient mask in flash
- Started
- Last post
- 9 Responses
- Bullitt
Trying to create a spot light effect in flash blacking out the background, but want a gradient around the mask to give it more realism. Can this be done easily?
Cheers.
- skt0
not with a mask
- skt0
you need a large black movieclip with a hole cut out of it, and a gradient applied to the edge of that hole.
- randalldon0
If you're using Flash 8+ (as2) you can do as skt says (black mc with hole cut out). You can use this as a gradient mask by applying a blur to the mc (with as2 or on the timeline). If you want any animation on the mask this will need to be done within the mc.
Once you have the blur applied to the mc and any animation sorted give the mask an instance name eg "maskInstance" and give your mc an instance name eg "mcInstance". Then is the first frame actions on the main timeline put this code:
mcInstance.setMask(maskInstance...
The final stage is to make sure you have "use runtime bitmap caching" ticked in the symbol properties for both the mc & the mask.
You should be good to go from there.
Hope it helps!
- randalldon0
Apologies missed the closing bracket - first frame code should be:
mcInstance.setMask(maskInstance...
- randalldon0
I see QBN won't let me put the closing bracket in - the last part should be (maskInstance)
- hoppa740
masked_mc.cacheAsBitmap = true;
maskMC.cacheAsBitmap = true;
masked_mc.setMask(maskMC);
- tbgd0
There's some source to do it very easily here. http://www.whatdoiknow.org/archiā¦
Thanks to Todd Dominey.
- skt0
this is interesting... hadn't realised flash had finally got its acto togethor with gradient masks.
- Bullitt0
Thanks for the advice guys!
Another question if you can help.
The idea behind this spotlight effect is for it to highlight areas of a graphic by using some buttons you rollover to navigate, either left or right. I'm shit with actionscript, can anyone direct me to a good tutorial that will allow me to scroll a graphic left or right.?What I got so far is a spotlight gradient effect, static. underneath is a movie clip which I will want to move either left of right ( areas of which will be highlighted underneath the spotlight gradient.)
Cheers,