• as3.0自定义事件。


    今天看到一个容易理解的as3.0自定义事件实例:

    package {
    	import flash.display.Sprite;
    	import flash.events.MouseEvent;
    	import flash.events.EventDispatcher;
    	public class myClip extends Sprite {
    		public function myClip() {
    			addEventListener(MouseEvent.CLICK,clickHander);
    		}
    		private function clickHander(evt:MouseEvent):void {
    			
    			var _clipEvent:clipEvent=new clipEvent();
    			_clipEvent.M="wangyan";
    			dispatchEvent(_clipEvent);
    		}
    	}
    }
    //库绑定类
    package {
    	import flash.events.Event;
    	public class clipEvent extends Event {
    		public static const CLIP_CLICK:String="clip_click";
    		private var _mm:String;
    		public function clipEvent() {
    			super(CLIP_CLICK);
    		}
    		public function get M() {
    			return _mm;
    		}
    		public function set M(a:String) {
    			_mm=a;
    		}
    	}
    }
    //自定义事件类
    function listen_clipEvent(evt:clipEvent) {
    	trace("hello"+evt);
    }
    abc.addEventListener(clipEvent.CLIP_CLICK,listen_clipEvent);
    
  • 相关阅读:
    K-means Algorithm
    Naive Bayes Algorithm
    Generalized Linear Models
    Support Vector Machine
    wordpress迁移
    Gaussian Discriminant Analysis
    Locally Weighted Regression
    Matlab绘图高级部分
    Supervised Learning-Regression
    html 字符串互转DOM
  • 原文地址:https://www.cnblogs.com/qshuyan/p/3880699.html
Copyright © 2020-2023  润新知