Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Actionscript 3 动作脚本对齐图形线条样式笔划?_Actionscript 3_Graphics_Line_Stroke_Linestyle - Fatal编程技术网

Actionscript 3 动作脚本对齐图形线条样式笔划?

Actionscript 3 动作脚本对齐图形线条样式笔划?,actionscript-3,graphics,line,stroke,linestyle,Actionscript 3,Graphics,Line,Stroke,Linestyle,是否可以将图形的笔划与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函数似乎不提供任何用于对齐笔划的内置

是否可以将图形的笔划与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中,可以将笔划对齐为居中(一半在填充物内/一半在填充物外)、内部(填充物内的边界)或外部。(在填充外部加边框)。

闪存中不支持此操作(即使在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();

Flash中不支持这一点(即使在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();