flex绘制不规则形状图形,并填充背景色

 

protected function button1_clickHandler(event:MouseEvent):void

{

var gra:Graphics = drawCenter.graphics;

drawCenter.graphics.beginFill(0x000000);

drawCenter.graphics.lineStyle(5, 0xBBBBBB);

gra.moveTo(50,50);

gra.lineTo(500,500); 

gra.lineTo(200,400);

gra.lineTo(50,200);

gra.lineTo(50,50);

drawCenter.graphics.endFill();

}

 

但是要注意graphics对应的UI的要有背景色设置或者backgroundAlpha设置,如果没有此属性,则可用Canvas控件

你可能感兴趣的:(Flex)