所有继承 UIComponent的组件要想背景为方格.可以使用图片.然后拓展.或者 override updateDisplayList方法如下:
public static const SQUARE_SIZE:Number = 40;//方格的尺寸
/** * 填充背景的方格 */ override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void{ var g:Graphics = this.graphics; g.beginFill(0x000000 , 0); g.drawRect(0 , 0 , unscaledWidth , unscaledHeight); g.endFill(); g.lineStyle(1 , 0x000000 , 0.1); for(var row:Number=0;row<unscaledHeight/SQUARE_SIZE;row++){ g.moveTo(0 , row*SQUARE_SIZE); g.lineTo(unscaledWidth , row*SQUARE_SIZE); } for(var col:Number=0;col<unscaledWidth/SQUARE_SIZE;col++){ g.moveTo(col*SQUARE_SIZE , 0); g.lineTo(col*SQUARE_SIZE , unscaledHeight); } }