# Circle..drawing by script..How ? please

**URL:** <https://forum.kirupa.com/t/circle-drawing-by-script-how-please/64355>\
**Category:** flash\
**Created:** [September 15, 2004, 3:11pm UTC](https://forum.kirupa.com/t/circle-drawing-by-script-how-please/64355 "2004-09-15T15:11:41Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![nasih](https://avatars.discourse-cdn.com/v4/letter/n/919ad9/32.png) [@nasih](https://forum.kirupa.com/u/nasih)\
**Post date:** [September 15, 2004, 3:11pm UTC](https://forum.kirupa.com/t/circle-drawing-by-script-how-please/64355/1 "2004-09-15T15:11:41Z")

</div>

Hi,

please check the attchmnt.

With this i want to get just a circle drawing effect.  
First draw outer circle, then draw second inner circle and last third inner circle.

thats all

Please give me some solutions

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 15, 2004, 3:20pm UTC](https://forum.kirupa.com/t/circle-drawing-by-script-how-please/64355/2 "2004-09-15T15:20:42Z")

</div>

Check out this super cool prototype written by our very own Senocular 🙂

[http://proto.layer51.com/d.aspx?f=952](http://proto.layer51.com/d.aspx?f=952)

:hr:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 15, 2004, 4:03pm UTC](https://forum.kirupa.com/t/circle-drawing-by-script-how-please/64355/3 "2004-09-15T16:03:33Z")

</div>

Hi,

thanks for you link. its an excellent stuff.

But Sorry, i am not that much programmer guy.  
may be i posted in a not proper place.

can you give me any more simple thing.

or if you dont mind an FLA .

I would be greatful …

> [@lunatic](#):
>
> Check out this super cool prototype written by our very own Senocular 🙂
> 
> [http://proto.layer51.com/d.aspx?f=952](http://proto.layer51.com/d.aspx?f=952)
> 
> :hr:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 15, 2004, 4:15pm UTC](https://forum.kirupa.com/t/circle-drawing-by-script-how-please/64355/4 "2004-09-15T16:15:31Z")

</div>

> [@nasih](#):
>
> Hi,
> 
> thanks for you link. its an excellent stuff.
> 
> But Sorry, i am not that much programmer guy.  
> may be i posted in a not proper place.
> 
> can you give me any more simple thing.
> 
> or if you dont mind an FLA .
> 
> I would be greatful …

just copy/paste this on the first frame

MovieClip.prototype.drawCircle = function(xpos, ypos, radius, lWidth, lColor) {  
x = xpos;  
y = ypos;  
r = radius;  
u = r_0.4086;  
v = r_0.7071;  
this.lineStyle(lwidth, lColor, 100);  
this.moveTo(x-r, y);  
this.curveTo(x-r, y-u, x-v, y-v);  
this.curveTo(x-u, y-r, x, y-r);  
this.curveTo(x+u, y-r, x+v, y-v);  
this.curveTo(x+r, y-u, x+r, y);  
this.curveTo(x+r, y+u, x+v, y+v);  
this.curveTo(x+u, y+r, x, y+r);  
this.curveTo(x-u, y+r, x-v, y+v);  
this.curveTo(x-r, y+u, x-r, y);  
};  
for (i=1; i\<4; i++) {  
createEmptyMovieClip(“paper”+i, i);  
}  
paper1.drawcircle(300, 200, 40, 1, 0x0000);  
paper2.drawcircle(300, 200, 60, 1, 0x0000);  
paper3.drawcircle(300, 200, 80, 1, 0x0000);

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 15, 2004, 4:46pm UTC](https://forum.kirupa.com/t/circle-drawing-by-script-how-please/64355/5 "2004-09-15T16:46:02Z")

</div>

Hi,

I copy/pasted in the first frame…  
but nothing to see… in stage  
Have I to change any parameters ?

* * *

MovieClip.prototype.drawCircle = function(xpos, ypos, radius, lWidth, lColor) {  
x = xpos;  
y = ypos;  
r = radius;  
u = r_0.4086;  
v = r_0.7071;  
this.lineStyle(lwidth, lColor, 100);  
this.moveTo(x-r, y);  
this.curveTo(x-r, y-u, x-v, y-v);  
this.curveTo(x-u, y-r, x, y-r);  
this.curveTo(x+u, y-r, x+v, y-v);  
this.curveTo(x+r, y-u, x+r, y);  
this.curveTo(x+r, y+u, x+v, y+v);  
this.curveTo(x+u, y+r, x, y+r);  
this.curveTo(x-u, y+r, x-v, y+v);  
this.curveTo(x-r, y+u, x-r, y);  
};  
for (i=1; i\<4; i++) {  
createEmptyMovieClip(“paper”+i, i);  
}  
paper1.drawcircle(300, 200, 40, 1, 0x0000);  
paper2.drawcircle(300, 200, 60, 1, 0x0000);  
paper3.drawcircle(300, 200, 80, 1, 0x0000);[/QUOTE]

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 15, 2004, 5:52pm UTC](https://forum.kirupa.com/t/circle-drawing-by-script-how-please/64355/6 "2004-09-15T17:52:37Z")

</div>

> [@nasih](#):
>
> Hi,
> 
> I copy/pasted in the first frame…  
> but nothing to see… in stage  
> Have I to change any parameters ?
> 
> * * *
> 
> MovieClip.prototype.drawCircle = function(xpos, ypos, radius, lWidth, lColor) {  
> x = xpos;  
> y = ypos;  
> r = radius;  
> u = r_0.4086;  
> v = r_0.7071;  
> this.lineStyle(lwidth, lColor, 100);  
> this.moveTo(x-r, y);  
> this.curveTo(x-r, y-u, x-v, y-v);  
> this.curveTo(x-u, y-r, x, y-r);  
> this.curveTo(x+u, y-r, x+v, y-v);  
> this.curveTo(x+r, y-u, x+r, y);  
> this.curveTo(x+r, y+u, x+v, y+v);  
> this.curveTo(x+u, y+r, x, y+r);  
> this.curveTo(x-u, y+r, x-v, y+v);  
> this.curveTo(x-r, y+u, x-r, y);  
> };  
> for (i=1; i\<4; i++) {  
> createEmptyMovieClip(“paper”+i, i);  
> }  
> paper1.drawcircle(300, 200, 40, 1, 0x0000);  
> paper2.drawcircle(300, 200, 60, 1, 0x0000);  
> paper3.drawcircle(300, 200, 80, 1, 0x0000);

[/QUOTE]

no, it works as it is.2 different ways here.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 15, 2004, 5:59pm UTC](https://forum.kirupa.com/t/circle-drawing-by-script-how-please/64355/7 "2004-09-15T17:59:40Z")

</div>

Small typos I guess, watch the capitals;)  
in paper1.drawcircle(etc) should be a capital C (and 0x000000)  
in this.lineStyle(lwidth, lColor, 100), capital W.

scotty(-:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 15, 2004, 6:02pm UTC](https://forum.kirupa.com/t/circle-drawing-by-script-how-please/64355/8 "2004-09-15T18:02:03Z")

</div>

> [@scotty](#):
>
> Small typos I guess, watch the capitals;)  
> in paper1.drawcircle(etc) should be a capital C (and 0x000000)  
> in this.lineStyle(lwidth, lColor, 100), capital W.
> 
> scotty(-:

probably

In the second dynamic function i have drawn them the wrong way round small to large, just change to  
myfunction = function () {  
clearInterval(myInterval);  
\_root[“paper”+k].drawcircle(80+L, 100, 200, 10);  
k++;  
L -= 20;  
};  
[http://www.gifsrus.com/testfile/drawcircle.swf](http://www.gifsrus.com/testfile/drawcircle.swf)

if you want to use the first just put in a setInterval so that outer is first etc

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 15, 2004, 6:29pm UTC](https://forum.kirupa.com/t/circle-drawing-by-script-how-please/64355/9 "2004-09-15T18:29:50Z")

</div>

if you use the code from the link originally posted, you could use this script to make it work:

```php
// ActionScript:
createEmptyMovieClip("circles", 1); // create clip to draw in
circles._x = circles._y = 150; // position it

myPath = new Path(); // create Path
myPath.moveTo(-50,0).circleTo(50,0).circleTo(-50,0); // inner circle
myPath.moveTo(-70,0).circleTo(70,0).circleTo(-70,0); // middle circle
myPath.moveTo(-90,0).circleTo(90,0).circleTo(-90,0); // outer circle

circles.percent = 0; // set percentage of drawing complete
circles.speed = 0.01; // speed of percentage increase
circles.onEnterFrame = function(){
	this.percent += this.speed; // increase percent
	if (this.percent > 1) this.percent = 1; // dont let go beyond 100% (percent == 1)
	this.clear(); // refresh drawing of this movie clip
	this.lineStyle(1,0,100); // reset the linestyle
	myPath.drawUpTo(this, this.percent); // draw the path in this movieclip up to percent
	if (this.percent == 1) delete this.onEnterFrame; // if 100%, remove onEnterFrame
}

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 16, 2004, 6:13am UTC](https://forum.kirupa.com/t/circle-drawing-by-script-how-please/64355/10 "2004-09-16T06:13:00Z")

</div>

Hi,

this.\_problemSolved(“true”)

Thanks for you all guys.  
Esp. for senocular…your code works fine.

best regards  
Nasih

> [@senocular](#):
>
> if you use the code from the link originally posted, you could use this script to make it work:
> 
> ```php
> // ActionScript:
> createEmptyMovieClip("circles", 1); // create clip to draw in
> circles._x = circles._y = 150; // position it
> 
> myPath = new Path(); // create Path
> myPath.moveTo(-50,0).circleTo(50,0).circleTo(-50,0); // inner circle
> myPath.moveTo(-70,0).circleTo(70,0).circleTo(-70,0); // middle circle
> myPath.moveTo(-90,0).circleTo(90,0).circleTo(-90,0); // outer circle
> 
> circles.percent = 0; // set percentage of drawing complete
> circles.speed = 0.01; // speed of percentage increase
> circles.onEnterFrame = function(){
> this.percent += this.speed; // increase percent
> if (this.percent > 1) this.percent = 1; // dont let go beyond 100% (percent == 1)
> this.clear(); // refresh drawing of this movie clip
> this.lineStyle(1,0,100); // reset the linestyle
> myPath.drawUpTo(this, this.percent); // draw the path in this movieclip up to percent
> if (this.percent == 1) delete this.onEnterFrame; // if 100%, remove onEnterFrame
> }
> 
> ```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 16, 2004, 9:33am UTC](https://forum.kirupa.com/t/circle-drawing-by-script-how-please/64355/11 "2004-09-16T09:33:59Z")

</div>

welcome 😉
