zoukankan      html  css  js  c++  java
  • 几个不同颜色方框——事件流

    package {
    	import flash.display.Sprite;
    	import flash.events.MouseEvent;
    	public class Main extends Sprite {
    		public function Main():void {
    			var a:Sprite=new Sprite();
    			drawSprite(a,200,200,0x00ff00,0,0);
    			a.name="外层";
    			var b:Sprite=new Sprite();
    			drawSprite(b,100,100,0xff0000,50,50);
    			b.name="中层";
    			var c:Sprite=new Sprite();
    			drawSprite(c,50,50,0x0000ff,75,75);
    			c.name="内层";
    			addChild(a);
    			a.addChild(b);
    			b.addChild(c);
    			a.addEventListener(MouseEvent.CLICK,look);
    			b.addEventListener(MouseEvent.CLICK,look);
    			c.addEventListener(MouseEvent.CLICK,look);
    		}
    		private function look(evt:MouseEvent):void {
    			trace("发生事件的对象:"+evt.target.name);
    			trace("正在侦听事件的目标:"+evt.currentTarget.name);
    			trace("当前帧听的阶段:"+evt.eventPhase);
    			trace("================");
    		}
    		private function drawSprite(obj:Sprite,w:uint,h:uint,color:uint,X:uint,Y:uint) {
    			obj.graphics.beginFill(color);
    			obj.graphics.drawRect(X,Y,w,h);
    			obj.graphics.endFill();
    		}
    	}
    }
    
  • 相关阅读:
    HDU 1496 Equations
    HDU 1060 Leftmost Digit
    HDU 1391 Number Steps
    HDU 1212 Big Number
    HDU 1491 Octorber 21st
    HDU 1339 A Simple Task
    HDU 2710 Max Factor
    HDU 1176 免费馅饼
    FORTH基本堆栈操作
    FORTH 安装使用
  • 原文地址:https://www.cnblogs.com/leon3286/p/1704418.html
Copyright © 2011-2022 走看看