/**
* Copyright yuugurenote ( http://wonderfl.net/user/yuugurenote )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/1fd4
*/
package {
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.events.Event;
import flash.geom.Point;
[SWF(width=465,height=465,backgroundColor=0xFFFFFF,frameRate=60)]
public class AS120110_01 extends Sprite {
public var sw:Number=stage.stageWidth;
public var sh:Number=stage.stageHeight;
public var _mySprite:mySprite;
public var _px1:Number;
public var _py1:Number;
public var _px2:Number;
public var _py2:Number;
public function AS120110_01() {
stage.addEventListener(MouseEvent.MOUSE_DOWN,xDown);
stage.addEventListener(MouseEvent.MOUSE_UP,xUp);
}
public function xDown(e:MouseEvent):void {
_px1=mouseX;
_py1=mouseY;
}
public function xUp(e:MouseEvent):void {
_px2=mouseX;
_py2=mouseY;
_mySprite=new mySprite(_px1,_py1,_px2,_py2);
addChild(_mySprite);
}
}
}
import flash.display.Sprite;
import flash.events.Event;
class mySprite extends Sprite {
public var px:Number=0;
public var cNum:Number = Math.random() * 0xFFFFFF;
public function mySprite(px1:Number,py1:Number,px2:Number,py2:Number):void {
this.graphics.clear();
this.graphics.lineStyle(1,cNum,1,false,"none");
this.graphics.moveTo(px1,py1);
this.graphics.lineTo(px2,py2);
this.addEventListener(Event.ENTER_FRAME,xEnter);
}
public function xEnter(e:Event):void {
this.alpha-=0.001;
if (this.alpha < 0) removeEventListener(Event.ENTER_FRAME, xEnter);
}
}