simple line 2
package {
import com.flashdynamix.utils.SWFProfiler;
import flash.display.*;
import flash.events.Event;
import caurina.transitions.Tweener;
[SWF(backgroundColor="#000000", frameRate=30)]
public class FlashTest extends MovieClip {
var lastX:Number;
var lastY:Number;
var _p:Sprite = new Sprite();
public function FlashTest() {
SWFProfiler.init(this);
_p.graphics.beginFill(0xFFFFFF);
_p.graphics.drawCircle(0, 0, 4);
_p.graphics.endFill();
this.addChild(_p);
this.addEventListener(Event.ENTER_FRAME, eventHandler);
lastX = 0;
lastY = 0;
}
private function eventHandler(e:Event):void {
lastX = _p.x;
lastY = _p.y;
_p.x += (mouseX-_p.x)/5;
_p.y += (mouseY-_p.y)/5;
drawLine(_p.x, _p.y, lastX, lastY);
}
private function drawLine(mX:Number, mY:Number, lX:Number, lY:Number):void {
var line:Shape = new Shape();
line.graphics.lineStyle(1, 0xFFFFFF);
line.graphics.moveTo(lX, lY);
line.graphics.lineTo(mX, mY);
this.addChild(line);
Tweener.addTween( line, {alpha:0.1, delay:0.5, time:1, onComplete:function():void{
this.removeChild(line);
line=null;
}
}
);
}
}
}