AS3 中可能存在颜色错误

Possible color error in AS3

我写了一个 AS3 程序(.swf 输出)关于一块板用鼠标移动,但是当我将颜色设置为蓝色时,结果是板的黄色外部区域包围着蓝色的内部区域。只有当用户点击屏幕时,它才会变成全蓝色。我怎样才能修改程序,使板在程序开始时变成蓝色而不用点击一次?程序上传到这个 link : http://titusngiscoding.wixsite.com/movingboard

这里是源代码,全部。

package 
{
    import flash.display.Sprite;
    import flash.events.MouseEvent;
    public class FlashTest extends Sprite 
    {
        public var board:Sprite;
        public function FlashTest() 
        {
            board = new Sprite();
            addChild(board);
            board.graphics.beginFill(0x0099ff);
            board.graphics.drawRect(0,stage.stageWidth-20,100,10);
            board.graphics.endFill();
            board.x = stage.stageWidth /2 - board.width/2;
            stage.addEventListener(MouseEvent.MOUSE_MOVE, onMouseEvent);
            stage.focus = board;
        }
        public function onMouseEvent(event:MouseEvent):void
        {
            board.x = event.localX - board.width/2;
            if(board.x <0)
                board.x = 0;
            if(board.x > stage.stageWidth - board.width)
                board.x = stage.stageWidth - board.width;
        }
    }
}

1) stage.focus = board; 此行导致黄色轮廓,删除它或解释为什么需要它。

2) board.graphics.drawRect(0,stage.stageWidth-20,100,10);为什么要设置stageWidth为Y轴?

也许你想要: board.graphics.drawRect(0,stage.stageHeight-20,100,10);

PS:不要忘记 board.x = event.localX,如果您愿意,可以是 board.x = stage.mouseX