# Rounded corners issue

**URL:** <https://forum.kirupa.com/t/rounded-corners-issue/57808>\
**Category:** flash\
**Created:** [July 16, 2004, 8:41am UTC](https://forum.kirupa.com/t/rounded-corners-issue/57808 "2004-07-16T08:41:13Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![mattiaswargren](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/mattiaswargren/32/631_2.png) [@mattiaswargren](https://forum.kirupa.com/u/mattiaswargren)\
**Post date:** [July 16, 2004, 8:41am UTC](https://forum.kirupa.com/t/rounded-corners-issue/57808/1 "2004-07-16T08:41:13Z")

</div>

Im in a hurry, so don’t give me the “please search before post”-talk. I need to draw a box with rounded corners. I can’t get a hang of it. I want to draw it from the following variables:

boxwidth = 200;  
boxheight = 200;  
radius = 5;

How do I draw this? You should see the artwork I have (by mistake) created while trying to get it right 😛

’

---

<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:** [July 16, 2004, 9:48am UTC](https://forum.kirupa.com/t/rounded-corners-issue/57808/2 "2004-07-16T09:48:20Z")

</div>

you cant script it. What you can do on the other hand is draw this figure using the drawing tools of flash…(lineTo and fill)

---

<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:** [July 16, 2004, 9:58am UTC](https://forum.kirupa.com/t/rounded-corners-issue/57808/3 "2004-07-16T09:58:51Z")

</div>

> [@mlk](#):
>
> you cant script it. What you can do on the other hand is draw this figure using the drawing tools of flash…(lineTo and fill)

I think you are [color=Red]wrong[/color]. I am almost ready with a function which does exactly this. I hope …

’

---

<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:** [July 16, 2004, 12:17pm UTC](https://forum.kirupa.com/t/rounded-corners-issue/57808/4 "2004-07-16T12:17:18Z")

</div>

done

---

<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:** [July 16, 2004, 5:36pm UTC](https://forum.kirupa.com/t/rounded-corners-issue/57808/5 "2004-07-16T17:36:39Z")

</div>

So, show us your handywork!

---

<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:** [July 18, 2004, 8:12pm UTC](https://forum.kirupa.com/t/rounded-corners-issue/57808/6 "2004-07-18T20:12:43Z")

</div>

```auto

 ////////////////////////////////////////////////////////////////////////////////////////////////////
 // Draw rectangle (p) ////////////////////////////////////////////////////////////////////////////
 // www.votem.net /////////////////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 MovieClip.prototype.draw_rect = function(x,y,w,h,r,lw,lc,la,fc,fa) {
 	with(this){
 		beginFill(fc,fa);
 		lineStyle(lw,lc,la);
 		moveTo(x+r,y);
 		lineTo(x+w-r,y);
 		curveTo(x+w,y,x+w,y+r);
 		lineTo(x+w,y+h-r);
 		curveTo(x+w,y+h,x+w-r,y+h);
 		lineTo(x+r,y+h);
 		curveTo(x,y+h,x,y+h-r);
 		lineTo(x,x+r);
 		curveTo(x,y,x+r,y);
 		endFill();
 	}
 }
 

```

---

<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:** [July 18, 2004, 9:43pm UTC](https://forum.kirupa.com/t/rounded-corners-issue/57808/7 "2004-07-18T21:43:10Z")

</div>

> I think you are wrong. I am almost ready with a function which does exactly this. I hope …

I think you didn’t understand my answer. What you did is exactly what I said should be done - didn’t you use the lineTo function ???

It’s been done before. What I meant is that there is no such function as drawRoundedRectangle(var,var,var,var,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:** [July 18, 2004, 10:14pm UTC](https://forum.kirupa.com/t/rounded-corners-issue/57808/8 "2004-07-18T22:14:35Z")

</div>

> [@mlk](#):
>
> It’s been done before. What I meant is that there is no such function as drawRoundedRectangle(var,var,var,var,etc…)

:snooze:
