Forked from: yd_niku's オレオレMouseEventを発行してみる diff:3 forked from: オレオレMouseEventを発行してみる yd_niku forked:1favorite:0lines:50license : MIT License modified : 2010-02-25 14:28:39 Embed Tweet package { import flash.display.*; import flash.events.*; import flash.utils.*; import flash.geom.*; import com.bit101.components.*; import frocessing.color.*; import flash.text.TextField; public class FlashTest extends Sprite { private var _target:IEventDispatcher; private var _timer:Timer = new Timer(200); private var _checkbox:CheckBox; private var _text:TextField; private var c:FColor; public function FlashTest() { //_target = stage; _target = new Sprite(); Sprite(_target).x = 200; // _target.addEventListener(MouseEvent.CLICK,clickHandler); _timer.addEventListener(TimerEvent.TIMER,timerHandler); c = new FColor(); c.hsv( 0, 1, 1 ); _checkbox = new CheckBox( stage, 10, 10, "auto", onChange ); _text = new TextField; _text.x = 100; _text.width = 300; _text.height= 300; _text.mouseEnabled = false; addChild(_text); } private function onChange(e:Event):void{ if(_checkbox.selected){ _timer.start(); graphics.clear(); } else{ _timer.stop(); graphics.clear(); } } public function clickHandler(e:MouseEvent):void{ if( e.target != _target ) return; c.h+=3; graphics.beginFill(c.value); graphics.drawCircle( e.stageX, e.stageY, 6 ); graphics.endFill(); } private function timerHandler(e:TimerEvent):void{ _target.dispatchEvent(new MouseEvent(MouseEvent.CLICK,true,false, Math.random()*465, Math.random()*465) ); } } } Code Fullscreen Preview Fullscreen FColor hsv clear dispatchEvent stage MouseEvent.CLICK mouseEnabled stop target stageY stageX MouseEvent height width TimerEvent value addEventListener start drawCircle Timer sort new page view favorite forked pv2697 forked from: forked from: オレオレ.. yd_niku forked:0 favorite:0lines:51 (diff:6)