Welcome to Dream.In.Code
Getting Help is Easy!

Join 86,248 Programmers. There are 2,199 online right now! Ask your question and get quick answers from Dream.In.Code experts. Join the #1 programming help community on the internet! Registration is fast and FREE... Join Now!

Chat LIVE With a Expert
Powered by LivePerson.com

Register to Make This Box Go Away!

draw rectangle with corner radius 8

 
Reply to this topicStart new topic

draw rectangle with corner radius 8, How to draw rectangle with curved corner

karunai
post 3 Nov, 2007 - 07:00 AM
Post #1


D.I.C Head

**
Joined: 10 Apr, 2006
Posts: 63



Hi

Anyone help me to draw rectangle with cuvred corner using action script


User is offlineProfile CardPM
Go to the top of the page
+Quote Post


girasquid
post 3 Nov, 2007 - 03:16 PM
Post #2


Barbarbar

Group Icon
Joined: 3 Oct, 2006
Posts: 953

Can you show us some attempt you've made towards solving the problem yourself?
User is online!Profile CardPM
Go to the top of the page
+Quote Post

whitecurve
post 30 Apr, 2008 - 05:54 AM
Post #3


New D.I.C Head

*
Joined: 30 Apr, 2008
Posts: 1

QUOTE(karunai @ 3 Nov, 2007 - 07:00 AM) *

Hi

Anyone help me to draw rectangle with cuvred corner using action script


ive been using this function for years, it does the job well.

CODE
function drawRoundedCornerRectangle(target_mc:MovieClip, boxWidth:Number,
  boxHeight:Number, cornerRadius:Number, fillColor:Number,
  fillAlpha:Number, lineThickness:Number, lineColor:Number, lineAlpha:Number):Void {
  with (target_mc) {
    beginFill(fillColor, fillAlpha);
    lineStyle(lineThickness, lineColor, lineAlpha);
    moveTo(cornerRadius, 0);
    lineTo(boxWidth - cornerRadius, 0);
    curveTo(boxWidth, 0, boxWidth, cornerRadius);
    lineTo(boxWidth, cornerRadius);
    lineTo(boxWidth, boxHeight - cornerRadius);
    curveTo(boxWidth, boxHeight, boxWidth - cornerRadius, boxHeight);
    lineTo(boxWidth - cornerRadius, boxHeight);
    lineTo(cornerRadius, boxHeight);
    curveTo(0, boxHeight, 0, boxHeight - cornerRadius);
    lineTo(0, boxHeight - cornerRadius);
    lineTo(0, cornerRadius);
    curveTo(0, 0, cornerRadius, 0);
    lineTo(cornerRadius, 0);
    endFill();
  }
}


An Example of using it is as follows:

CODE
this.createEmptyMovieClip("MockTest_background", _root.getNextHighestDepth());
MockTest_background._x = 50;
MockTest_background._y = 110;
drawRoundedCornerRectangle(MockTest_background, 650, 290, 8, 0xFFFFFF, 25, 2, 0xFFFFFF, 100);

User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 5/16/08 08:49AM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month