1

I have a mask on a movieClip, and I want the player to be able to move the mouse to uncover the movie clip. How do I make the multiple paths on the mask add together instead of interfere with each other?

var maskObj:MovieClip = new MovieClip();
pScalp.mask = maskObj;

//function on user input
//lastLeft,lastRight,tempLeft,tempRight refer to where the mouse is now and where it was before
    maskObj.graphics.beginFill(0x00000000);
    maskObj.graphics.drawPath(Vector.<int>([1,2,2,2,2]),
                          Vector.<Number>([lastLeft.x, lastLeft.y,
                                           lastRight.x, lastRight.y,
                                           tempRight.x, tempRight.y,
                                           tempLeft.x, tempLeft.y,
                                           lastLeft.x, lastLeft.y]),
                                           GraphicsPathWinding.NON_ZERO);
    pScalp.mask = maskObj;
    maskObj.graphics.endFill();
//end function
QuinnBaetz
  • 559
  • 9
  • 23
  • The title says you don't want it to be additive, text says you want to add the masks. Please explain more what happens when you add multiple paths and how you want it different to that. – kapex Dec 11 '11 at 22:10

1 Answers1

0

As far as I know, there is no wholesale way to make everything additive, regardless of the path orientation. Instead, if you can guarantee that the order of the points on the path to be drawn are always in a clockwise (or always counterclockwise) orientation then using the GraphicsPathWinding.NON_ZERO should result in the additive effect that you are asking for.

There is already a discussion of algorithms to accomplish this already on SO, Sort Four Points in Clockwise Order, which should help you to this end.

Also, here's a link to the relevant Adobe Documentation on Winding Rules..

Community
  • 1
  • 1
merv
  • 67,214
  • 13
  • 180
  • 245