Groups | Blog | Home
all groups > flash actionscript > july 2007 >

flash actionscript : Applying outline to movieclip


Rrrrrrrrrk
7/19/2007 10:54:41 PM
Version: CS3, Windows XP

I'd like to be able to apply a stroke outline to a symbol at runtime. Is there
any way to do this?

Adding a glow filter to the symbol can achieve the general effect I want, but
can be quite memory intensive. It also does too much - I don't really need any
blurring, just a basic matt outline will do.

Thanks
Rick
craus
7/20/2007 4:20:56 PM
I whipped this up real quick just now and I only have AS2 but your welcome to
it.
I hope it's useful, with a Symbol_mc already on stage:

var outline:Number=20;

duplicateMovieClip(Symbol_mc, "newSymbol_mc", swapDepths(Symbol_mc));
var my_color:Color = new Color(newSymbol_mc);
my_color.setRGB(0x777777);
newSymbol_mc._x = Symbol_mc._x - (outline / 2); // you can leave this out
for a dropshadow
newSymbol_mc._y = Symbol_mc._y - (outline / 2); // you can leave this out
for a dropshadow
newSymbol_mc._width = Symbol_mc._width + outline;
newSymbol_mc._height = Symbol_mc._height + outline;

Rrrrrrrrrk
7/22/2007 10:36:45 PM
Thanks Craus but that won't create a proper outline except for simple shapes
(with complex shapes, the outline width will be uneven in the middle). It's
fine for drop shadow though.

Any other ideas?
kglad
7/22/2007 11:37:26 PM
Rrrrrrrrrk
7/23/2007 10:01:03 PM
kglad
7/24/2007 3:50:57 AM
Rrrrrrrrrk
7/24/2007 9:26:54 PM
Thanks kglad, but that was what I was doing originally (see opening question).

kglad
7/24/2007 9:57:51 PM
there's no blur with strength at max so from your first message it didn't look
like you were doing what i suggested.

but yes, i don't know any easier or better or more efficient way to add a
dynamic border.

8/16/2007 2:14:04 PM
[quoted text, click to view]

Outline accessing/creating/duplicating functions can't be hard to
implement.
The fact that they still don't(?) exist in AS leaves me quite open-
mouthed.
AddThis Social Bookmark Button