2010-06-13 3 views
1

그래픽의 획을 actionscript와 정렬 할 수 있습니까? 예를 들어 다음 코드는 자동으로 가운데 정렬 된 회색 선이있는 검정색 둥근 사각형을 만듭니다.ActionScript 줄 맞춤 그래픽 선 스타일 획?

var t:Sprite = new Sprite(); 
t.graphics.lineStyle(5, 0x555555); 
t.graphics.beginFill(0, 1); 
t.graphics.drawRoundRect(25, 25, 200, 75, 25, 25); 
t.graphics.endFill(); 

lineStyle 함수는 획 맞춤을위한 기본 제공 기능을 제공하지 않는 것 같습니다. Adobe Illustrator에서는 스트로크를 가운데 (반에서 1/2), 안쪽 (채우기 내의 경계) 또는 바깥쪽으로 정렬 할 수 있습니다. (채우기 바깥 쪽 경계).

답변

4

플래시에서는 (GUI에서도) 지원되지 않습니다. 이 효과를 시뮬레이트하려면 drawRoundRect 매개 변수를 수정해야합니다.

var strokeWidth:Number = 5; 
var strokeAlign:String = 'outer'; 
var t:Sprite = new Sprite(); 
t.graphics.lineStyle(strokeWidth, 0x555555); 
t.graphics.beginFill(0, 1); 
if (strokeAlign == 'outer') { 
    t.graphics.drawRoundRect(25 - strokeWidth/2, 25 - strokeWidth/2, 200 + strokeWidth, 75 + strokeWidth, 25 + strokeWidth/2, 25 + strokeWidth/2); 
} else if (strokeAlign == 'inner') { 
    t.graphics.drawRoundRect(25 + strokeWidth/2, 25 + strokeWidth/2, 200 - strokeWidth, 75 - strokeWidth, 25 - strokeWidth/2, 25 - strokeWidth/2); 
} else { 
    t.graphics.drawRoundRect(25, 25, 200, 75, 25, 25); 
} 
t.graphics.endFill(); 
관련 문제