Draw line

Code Actionscript 2.0

Frame action

createEmptyMovieClip("drawing", 1);
drawing.lineStyle(4, 0x000000, 100);
drawing.moveTo(_xmouse, _ymouse);
onEnterFrame = function () {
drawing.lineTo(_xmouse, _ymouse);
};

Code Actionscript 3.0

addEventListener(Event.ENTER_FRAME, enterFrame); var drawing:MovieClip = new MovieClip(); drawing.graphics.lineStyle(4, 0x000000, 1); drawing.graphics.moveTo(mouseX, mouseY); this.addChild(drawing); function enterFrame(event:Event) { drawing.graphics.lineTo(mouseX, mouseY); }

Description

This is a simple drawing example with a pen that never leaves the paper. The script draws a line from the last, to the present, mouse position.

related to: Drawing program

Download

Right click: Flashfile AS 2.0 | Flashfile AS 3.0 | SWF-File


Share