Hi Guys,

I think most of you AS coders have experience with masking MovieClip(or
DisplayObject in AS3), generally, we will do it like this:

1.Create the display object *A* you need to be masked, located it in it's
parent.
2.Create another display object *B* in same parent to the need masked
object.
3.Sets the mask property *A.mask = B* to make it works.

Well, it is not hard to do. But have you thought about that in fact it is
not simple, it always need a extra display object and must put it in the
display list too, Even we just want to be mask by a rectangle(in fact most
time we just need mask by a rectangle).

Let's imagine there's a property named maskRect of DisplayObject(or
MovieClip in AS2), generally, we can do mask like this:

1.Create the display object *A* you need to be masked.
2.Sets its maskRect property *A.maskRect = aRect*.

It is very simpler and easier than first way? And, the important, it does
not need extra display object, less Events fires(Event.ADD, Event.Remove),
less children for it's parent to manage, less CPU/Memory use...

You may say just use scrollRect, it can do similar thing. Yes, it can, but
just similar thing. But it is not suit for masking, first, it scroll
contents, and it will return wrong value for globalToLocal and localToGlobal
of it's children if it's content scrolled. Second, it's bugy, you can find
the big bug demos on my blog:http://www.rgenerat.org/iileyblog/ . In fact,
scrollRect just suit for scroll some pure graphics, for example Bitmaps. So
it is not as same as maskRect.

If you are developing components, and your component need masked bounds,
you'll find in fact you need at least THREE display object per one component
better, one(A) to be the root of component, one(B) is mask, one(C) is
masked, B and C is children of A(In fact this is the design of AsWing AS2
version). If we have maskRect property, we can just use one display object
for most component, it can decreased the display object numbers to 1/3 of
old ways(I'm try to achieve this design in AsWing AS3 version).

My dear coders, do you think you need this?  Do you think the new way can
enhance your power, your efficency, making the life happy, make the world
more beautiful? Or you are used to create mask display object, the new way
has no meanning for you?

Please feedback me, if many of us really need this, i think Adobe
must will consider to support this....

Regards~~

--
iiley
AsWing http://www.aswing.org
Personal http://www.iiley.com

Reply via email to