我是新的 Flash 和动作脚本。这就是问题所在。我创建了一个简单的应用程序。并且只在舞台上添加了两个项目。一个影片剪辑对象和一个按钮对象。影片剪辑对象设置了鼠标事件侦听器以在其上绘制。但是当我绘制时,线条被绘制在影片剪辑对象后面(在舞台上),我想在对象上绘制它。这是我的代码
var write: Boolean;
write = false;
board.addEventListener(MouseEvent.MOUSE_DOWN, startWriting);
board.addEventListener(MouseEvent.MOUSE_MOVE, continueWriting);
board.addEventListener(MouseEvent.MOUSE_UP, stopWriting);
board.addEventListener(MouseEvent.MOUSE_OUT, stopWriting);
btnHide.addEventListener(MouseEvent.MOUSE_DOWN, hideBoard);
var g:Graphics = graphics;
g.lineStyle(1, 0x0000ff);
function startWriting(e:MouseEvent):void {
g.moveTo(mouseX, mouseY);
write = true;
}
function continueWriting(e:MouseEvent):void {
if(write) {
g.lineTo(mouseX, mouseY);
}
}
function stopWriting(e:MouseEvent):void {
write = false;
}
function hideBoard(e:MouseEvent):void {
if (board.visible){
board.visible = false;
}
else {
board.visible = true;
}
}
所以问题是我如何在影片剪辑对象上绘图