2012-07-03 59 views
0

我对Actionscript 3有点新。我在Flash中创建一个svg导出/导入,并且需要使预览表现与svg相同。在闪存中,如果路径重叠,则将其删除。我如何使它填满整个区域?Actionscript 3 - 路径重叠

的路径与该创建的:

object.graphics.moveTo(xpos[i], ypos[i]); 
object.graphics.lineTo(px, py); 

结果是enter image description here

回答

3

这是由图形路径绕组引起的。

graphics-path-winding

Defining winding rules
flash.diplay.GraphicsPathWinding

在Flash中,默认的缠绕规则是偶奇。

对于使用drawPath产生的图形,增添GraphicsPathWinding.NON_ZERO缠绕到您的drawPath:

import flash.display.GraphicsPathWinding; 

graphics.drawPath(new <int>[], new <Number>[], GraphicsPathWinding.NON_ZERO); 

对于采用方便的方法绘制的图形,如lineTo()drawCircle(),或drawRect(),你可以beginFill()endFill()每形状绘制,如:

enter image description here

var g:Graphics = graphics; 

g.beginFill(0x123456) 
g.drawRect(100, 100, 50, 50); 
g.endFill(); 

g.beginFill(0x123456) 
g.drawRect(125, 125, 50, 50); 
g.endFill(); 

相反的:

even-odd

var g:Graphics = graphics; 

g.beginFill(0x123456) 
g.drawRect(100, 100, 50, 50); 
g.drawRect(125, 125, 50, 50); 
g.endFill(); 
+1

你有知识的怪异,但最有趣的收集,我知道。 – Marty

+0

回到此:beginFill,endFill for lineto不起作用。所讨论的重叠是一个连续的“lineto”的结果。 (参考上面的图片。)我正在将lineto转换为drawPath。 – teynon