03.05.2013 Views

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

anchorX:Number - An integer that specifies the horizontal position of the next anchor point<br />

relative to the registration point of the parent movie clip.<br />

anchorY:Number - An integer that specifies the vertical position of the next anchor point<br />

relative to the registration point of the parent movie clip.<br />

Example<br />

The following example draws a nearly circular curve with a solid blue hairline stroke <strong>and</strong> a<br />

solid red fill:<br />

this.createEmptyMovieClip("circle_mc", 1);<br />

with (circle_mc) {<br />

lineStyle(0, 0x0000FF, 100);<br />

beginFill(0xFF0000);<br />

moveTo(0, 100);<br />

curveTo(0,200,100,200);<br />

curveTo(200,200,200,100);<br />

curveTo(200,0,100,0);<br />

curveTo(0,0,0,100);<br />

endFill();<br />

}<br />

The curve drawn in this example is a quadratic Bezier curve. Quadratic Bezier curves consist<br />

of two anchor points <strong>and</strong> a control point. The curve interpolates the two anchor points, <strong>and</strong><br />

curves toward the control point.<br />

The following script uses the curveTo() method <strong>and</strong> the Math class to create a circle:<br />

this.createEmptyMovieClip("circle2_mc", 2);<br />

circle2_mc.lineStyle(0, 0x000000);<br />

drawCircle(circle2_mc, 100, 100, 100);<br />

function drawCircle(mc:MovieClip, x:Number, y:Number, r:Number):Void {<br />

mc.moveTo(x+r, y);<br />

mc.curveTo(r+x, Math.tan(Math.PI/8)*r+y, Math.sin(Math.PI/4)*r+x,<br />

Math.sin(Math.PI/4)*r+y);<br />

mc.curveTo(Math.tan(Math.PI/8)*r+x, r+y, x, r+y);<br />

mc.curveTo(-Math.tan(Math.PI/8)*r+x, r+y, -Math.sin(Math.PI/4)*r+x,<br />

Math.sin(Math.PI/4)*r+y);<br />

mc.curveTo(-r+x, Math.tan(Math.PI/8)*r+y, -r+x, y);<br />

mc.curveTo(-r+x, -Math.tan(Math.PI/8)*r+y, -Math.sin(Math.PI/4)*r+x,<br />

MovieClip 865

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!