forked from: EventListener
♥0 |
Line 37 |
Modified 2012-11-24 01:28:18 |
MIT License
archived:2017-03-30 08:28:44
ActionScript3 source code
/**
* Copyright hemingway ( http://wonderfl.net/user/hemingway )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/9ucG
*/
// forked from junsucom's EventListener
package {
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
public class FlashTest extends Sprite {
private var m_bIsDown:Boolean;
private var m_uX:uint;
private var m_uY:uint;
public function FlashTest() {
m_bIsDown = false;
this.parent.stage.addEventListener(MouseEvent.MOUSE_DOWN, doMouseDown);
this.parent.stage.addEventListener(MouseEvent.MOUSE_UP, doMouseUp);
this.parent.stage.addEventListener(Event.ENTER_FRAME, doEnterFrame);
graphics.lineStyle(1, 0);
}
private function doMouseDown(evt:MouseEvent):void
{
m_bIsDown = true;
m_uX = mouseX;
m_uY = mouseY;
}
private function doMouseUp(evt:MouseEvent):void
{
m_bIsDown = false;
}
private function doEnterFrame(evt:Event):void
{
if (m_bIsDown)
{
graphics.moveTo(m_uX , m_uY);
m_uX = mouseX;
m_uY = mouseY;
graphics.lineTo(m_uX, m_uY);
}
}
}
}