如何在舞台的另一侧绘制相同的图片,如下例所示?
http://i.stack.imgur.com/JrkXA.png
这是我的代码:
var drawingLine:Sprite = new Sprite();
addChild(drawingLine);
stage.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
function mouseDownHandler(event:MouseEvent):void {
timer.start();
drawingLine.graphics.lineStyle(3, coloursArray[position]);
drawingLine.graphics.moveTo(mouseX, mouseY);
stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
}
function mouseMoveHandler(event:MouseEvent):void {
drawingLine.graphics.lineTo(mouseX, mouseY);
}
function mouseUpHandler(event:MouseEvent):void {
timer.stop();
stage.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
}
function changeColour(e:TimerEvent):void{
position++;
答案 0 :(得分:0)
您可以使用copyForm method
的{{1}}:
将源Graphics对象中的所有绘图命令复制到 调用Graphics对象。
一般表格:
destinationObject.graphics.copyFrom(sourceObject.graphics);
您的代码:
Graphics class