マウスポインタをツールとして使用し、onMouseMove と Drawing API を使用して線を描画します。ユーザーがマウスカーソルをドラッグすると、線が描かれます。
this.createEmptyMovieClip("canvas_mc", this.getNextHighestDepth()); var mouseListener:Object = new Object();
mouseListener.onMouseDown = function() { this.isDrawing = true; canvas_mc.lineStyle(2, 0xFF0000, 100); canvas_mc.moveTo(_xmouse, _ymouse); };
mouseListener.onMouseMove = function() { if (this.isDrawing) { canvas_mc.lineTo(_xmouse, _ymouse); } updateAfterEvent(); };
mouseListener.onMouseUp = function() { this.isDrawing = false; };
Mouse.addListener(mouseListener);