1674
2011-06-08 21:27:48
0
네 방사형그래프 만들고 있는데 사용자값중 0이 들어오면 그값 중앙에 붙게 되서 반지름 25의 여분이 필요했거든요 ㅋ 감사합니다
var child:Shape = new Shape();
var param:Object = LoaderInfo(this.root.loaderInfo).parameters;
var points = String(param.data).split(",");
child.graphics.lineStyle(borderThickness, borderColor);
var firstx:Number = 0;
var firsty:Number = 0;
for(var i:Number = 0; i<points.length;i++){
var p:Number = getPoint(points[i]) * gap;
var angle:Number = 360/points.length * i ;
var radian:Number = angle * Math.PI / 180;
var posx:Number = p * Math.sin(radian);
var posy:Number = p * Math.cos(radian);
if(i == 0){
firstx = posx;
firsty = posy;
child.graphics.moveTo(posx,posy);
}else{
child.graphics.lineTo(posx,posy);
}
}
child.graphics.lineTo(firstx,firsty);
child.graphics.endFill();
point.addChild(child);
func-tion getPoint(value:Number):Number{
return 3*value/4 + 25;
}