flash on 2015-1-29
package {
import flash.display.Shape;
import flash.display.Sprite;
import flash.events.MouseEvent;
[SWF(backgroundColor=0)]
public class FlashTest extends Sprite {
public function FlashTest() {
// code by Nig 13 from http://board.flashkit.com/board/showthread.php?833851-Paint-Splatter-Writing
var mc:Shape = new Shape();
addChild(mc);
var X1:Number = mouseX;
var Y1:Number = mouseY;
stage.addEventListener(MouseEvent.MOUSE_MOVE, drawTrail);
function drawTrail(e:MouseEvent):void {
var X2:Number = mouseX;
var Y2:Number = mouseY;
var diffX:Number = X2 - X1;
var diffY:Number = Y2 - Y1;
var diff:Number = Math.sqrt((diffX*diffX)+(diffY*diffY));
mc.graphics.lineStyle(100/diff, 0xFFFFFF, .5);
mc.graphics.moveTo(X1, Y1);
mc.graphics.lineTo(X2, Y2);
X1 = X2;
Y1 = Y2;
}
}
}
}