オレオレMouseEventを発行してみる yd_niku forked:1favorite:4lines:49license : MIT License modified : 2010-02-25 14:27:13 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.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 hack_er_dj nki2 Nyarineko cpu_t : Event発行 Event発行 FColor stage hsv clear dispatchEvent MouseEvent.CLICK mouseEnabled stop target stageY stageX MouseEvent height width TimerEvent value addEventListener start drawCircle Timer sort new page view favorite forked pv2942 forked from: オレオレMouseEventを発行.. yd_niku forked:1 favorite:0lines:50 (diff:3)