-
Drawing a circle dynamically?!?
Hi guys
Can anyone help me convert the code below to create a circle using the curveTo() command.
Would really appreciate it
Cheers
Ol
_root.onMouseDown = function() {
x0 = _root._xmouse;
y0 = _root._ymouse;
draw();
};
function draw() {
_root.onMouseMove = function() {
x1 = _root._xmouse;
y1 = _root._ymouse;
_root.clear();
_root.lineStyle(1, 0x000000, 100);
_root.moveTo(x0, y0);
_root.lineTo(x0, y1);
_root.lineTo(x1, y1);
_root.lineTo(x1, y0);
_root.lineTo(x0, y0);
};
}
-
From flash mx actionscript reference by friends of ED:
_root.createEmptyMovieClip("circle", 100);
x = 275; // X-coordinate circle centre
y = 200; // Y-coordinate circle centre
R = 100; // Radius of circle
a = R*0.4086; // Radius multiplied by constant
b = R*0.7071; // Radius multiplied by constant
circle.lineStyle(5, 0x000000, 90);
circle.moveTo(x-R, y);
circle.curveTo(x-R, y-a, x-b, y-b);
circle.curveTo(x-a, y-R, x, y-R);
circle.curveTo(x+a, y-R, x+b, y-b);
circle.curveTo(x+R, y-a, x+R, y);
circle.curveTo(x+R, y+a, x+b, y+b);
circle.curveTo(x+a, y+R, x, y+R);
circle.curveTo(x-a, y+R, x-b, y+b);
circle.curveTo(x-R, y+a, x-R, y);
back to work at flashclub.nl.
Ngezi
-
Any idea what the constant is based on?
-
I don't even know where to begin!?! Can anyone explain it to me?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|