NEU: Alle Visual Codes als Code Snippets für Flash CS5:
jetzt hier downloaden .

Zufallslinien

Code Actionscript 2.0

Frame-Aktion

createEmptyMovieClip("drawing", 1);
drawing.lineStyle(0, 0x000000, 100);
onMouseDown = function () {
mousepressed = 1;
px = _xmouse;
py = _ymouse;
drawing.moveTo(px, py);
};
onMouseUp = function () {
mousepressed = 0;
};
onEnterFrame = function () {
px = _xmouse + (random(40) - 20);
py = _ymouse + (random(40) - 20);
drawing.lineStyle(1, 0x000000, 100);
if (mousepressed == 1) {
drawing.lineTo(px, py);
}
};

Code Actionscript 3.0

addEventListener(Event.ENTER_FRAME, enterFrame); stage.addEventListener(MouseEvent.MOUSE_DOWN, press); stage.addEventListener(MouseEvent.MOUSE_UP, release); var drawing:MovieClip = new MovieClip(); drawing.graphics.lineStyle(0, 0x000000, 1); this.addChild(drawing); var mousepressed=0; function press(e:MouseEvent) { mousepressed = 1; var px = mouseX; var py = mouseY; drawing.graphics.moveTo(px, py); } function release(e:MouseEvent) { mousepressed = 0; } function enterFrame(e:Event) { var px = mouseX + (int(Math.random()*40) - 20); var py = mouseY + (int(Math.random()*40) - 20); drawing.graphics.lineStyle(1, 0x000000, 1); if (mousepressed == 1) { drawing.graphics.lineTo(px, py); } }

Infos

Bei diesem Programm beschränkt sich die Zeichentätigkeit des Benutzers auf das Setzen von Startpunkten, in onMouseDown (function press in Actionscript 3). Von diesen Punkten aus zeichnet das Programm eine zufällige Linie, so lange die Maustaste gedrückt bleibt.

Download

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


Share