Hello,
I need a tipp for drawing an oval around a dynamic textfield with
variable line numbers and variable width? Perhaps, someone can point
me to a good tutorial dealing with such geometry questions.
The drawOval methods I am using have width and height as parameters,
but of course I can't use width and height of the textfield without a
padding. How can I calculate an i appropriate padding?
The drawOval methods:
public function drawOval_Old(x:Number, y:Number, width:Number,
height:Number):Void
{
movieClip.lineStyle(lw, lc, la);
movieClip.moveTo(x,y+height/2);
movieClip.curveTo(x,y,x+width/2, y);
movieClip.curveTo(x+width,y,x+width, y+height/2);
movieClip.curveTo(x+width,y+height, x+width/2, y+height);
movieClip.curveTo(x,y+height, x, y+height/2);
}
public function drawOval(x:Number, y:Number, width:Number, height:Number):Void
{
x+=width/2;
y+=height/2;
width/=2;
height/=2;
var j:Number = width * 0.70711;
var n:Number = height * 0.70711;
var i:Number = j - (height - n) * width/height;
var m:Number = n - (width - j) * height/width;
movieClip.lineStyle(lw, lc, la);
movieClip.moveTo(x+width, y);
movieClip.curveTo(x+width, y-m, x+j, y-n);
movieClip.curveTo(x+i, y-height, x, y-height);
movieClip.curveTo(x-i, y-height, x-j, y-n);
movieClip.curveTo(x-width, y-m, x-width, y);
movieClip.curveTo(x-width, y+m, x-j, y+n);
movieClip.curveTo(x-i, y+height, x, y+height);
movieClip.curveTo(x+i, y+height, x+j, y+n);
movieClip.curveTo(x+width, y+m, x+width, y);
}
Thanks,
Matthias
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com