this may be a silly question, but how exactly do you draw something in "reverse order". I understand the concept, but I am not sure how to do it. Can you do it with the Graphics class or do you need to dig deeper?

Thanks,

- Kevin


On Oct 25, 2007, at 12:13 AM, Jon Bradley wrote:



On Oct 24, 2007, at 9:08 PM, shaun wrote:

Could you explain this idea of "reverse order" a bit more or provide a
url with some information about how to do this. I dont think I really
understand how to implement it.

"Reverse Order" is the opposite ordering of control points, or knots, on a curve or sequence of lines. Technically reverse drawing order is counter-clockwise. All Graphics class functions in AS3 are clockwise.

The most obvious usage of drawing in different directions, clockwise or counter- clockwise, is so that you can create holes (cutouts) within fills.

..... example attached below.

- jon


In AS2, here's a quickie example.....

function drawRect(target:MovieClip, x:Number,y:Number, width:Number, height:Number, reverse:Boolean):Void {
        if (!reverse)
        {
                target.moveTo(x, y);
                target.lineTo(x+width, y);
                target.lineTo(x+width, y+height);
                target.lineTo(x, y+height);
                target.lineTo(x, y);
        }
        else
        {
                target.moveTo(x,y);
                target.lineTo(x, y+height);
                target.lineTo(x+width,y+height)
                target.lineTo(x+width,y);
                target.lineTo(x,y);
        }
}

var mc:MovieClip = this.createEmptyMovieClip("some_mc", 0);

mc.beginFill(0x000000);
drawRect(mc, 0,0,100,100,false);
drawRect(mc, 10, 10, 80, 80, true);
drawRect(mc, 45,45,100,10,false);
mc.endFill();




Reply via email to