Reputation: 53
How to draw angle in flex There are tools for drawing rectangle,ellipse etc in flex Didn't find anything to draw an angle
Upvotes: 0
Views: 359
Reputation: 2210
If you mean simple arcs you can use
graphics.curveTo()
method. Look :Adobe help about drawing lines and curves.
If you want something better look : Here
And for Angles a modified version of Emanuele Feronoto's algorithm:
package {
import flash.display.Sprite;
public class angle extends Sprite {
var my_canvas:Sprite = new Sprite();
var deg_to_rad=0.0174532925;
public function angle() {
addChild(my_canvas);
my_canvas.graphics.lineStyle(20,0xff0000,1);
draw_angle(my_canvas,250,200,150,14,180);
}
public function
draw_angle(movieclip,center_x,center_y,radius,angle_from,angle_to) {
var angle=angle_from;
var px=center_x+radius*Math.cos(angle*deg_to_rad);
var py=center_y+radius*Math.sin(angle*deg_to_rad);
movieclip.graphics.moveTo(center_x, center_y);
movieclip.graphics.lineTo(px,py);
angle=angle_to;
px=center_x+radius*Math.cos(angle*deg_to_rad);
py=center_y+radius*Math.sin(angle*deg_to_rad);
movieclip.graphics.moveTo(center_x, center_y);
movieclip.graphics.lineTo(px,py);
}
}
}
Upvotes: 1
Reputation: 437
Well, your question is a bit unclear as angles are units of measure, so you can't in fact 'draw' them like you would with other graphical objects. That would be the same if I ask how to draw celsius degrees of temperature - i did search for that method but i can't find it. So you either want 1. to draw 2 lines (or rays) forming an certain angle, or 2. draw an 'graphical' angle representation - that you can do with arcs like answered already. Furthermore, angles can be expressed in radians, degrees and grads, so you must decide what will be your preferred unit for inputing.
Upvotes: 0
Reputation: 1890
There are no any special tools for drawing angels in .graphics. You can make angle-drawing utility yourself, using standart graphics.lineTo(x,y) tool. If you'll concretize your goal, I can help you.
Upvotes: 0