Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Ho hum ( actionscripting the hard way )

Ho hum ( actionscripting the hard way )
Thread Tools
Mac Elite
Join Date: Mar 2002
Location: Clogland
Status: Offline
Reply With Quote
Nov 25, 2004, 06:53 AM
 
Two ways of using Flash Actionscript to make a rounded oval shape similar to the dark blue one on the top of this forum.

You could work out all the co-ordinates to make the outline complete the shape, this will take a bit of pen and paper work, and maybe an hour or so to figure out.

function round_rectangle(width,height,x,y){
this.createEmptyMovieClip("round_rectangle_mc",-1); round_rectangle_mc.lineStyle(1,0x000000,0); // invisible
h=height/2;
i=x+h;
j=x+width-h;
k=y-h;
l=y+h;
w=x+width;
round_rectangle_mc.beginFill(0xOOOOFF,100);
round_rectangle_mc.moveTo(x,y);
round_rectangle_mc.curveTo(x,l,i,l);
round_rectangle_mc.lineTo(j,l);
round_rectangle_mc.curveTo(w,l,w,y);
round_rectangle_mc.curveTo(w,k,j,k);
round_rectangle_mc.lineTo(i,k);
round_rectangle_mc.curveTo(x,k,x,y);
round_rectangle_mc.endFill();
}
Or you could just draw one fat line (lines in Flash have rounded ends anyway), this takes about three months to think of and about five minutes to produce.

var roundRect:MovieClip = this.createEmptyMovieClip("round_rectangle_mc",-1);
round_rectangle_mc.lineStyle(34,0xOOOOFF,33);
round_rectangle_mc.moveTo(30,30);
round_rectangle_mc.lineTo(678,30);
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 09:22 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2