She walks in beauty like the night // Hypnotising the silence with her powers // Armageddon is bedding this picture alright // My Marilyn come to slum for an hour. An actionscript and music blog.

Basic Line Drawer

Posted: February 13th, 2009 | Author: Janice | Filed under: Uncategorized | No Comments »

Basic line drawer: (preview link)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// add stage listeners 
stage.addEventListener(MouseEvent.MOUSE_DOWN, onDown); 
stage.addEventListener(MouseEvent.MOUSE_UP, onUp); 
 
function onDown(e:Event):void {
 graphics.moveTo(mouseX, mouseY); 
 addEventListener(Event.ENTER_FRAME, onLoop);
}
 
function onUp(e:Event):void {
 removeEventListener(Event.ENTER_FRAME, onLoop);
}
 
// bit shifting colours
function onLoop(e:Event):void {
 graphics.lineStyle((Math.random()*45), Math.random()*0xFFFFFF >> 23, Math.random(), true, "normal"); // blue=black
 graphics.lineTo(mouseX, mouseY);    
}


Leave a Reply