zoukankan      html  css  js  c++  java
  • as3 组件定义

    package  kingBook{
    	import flash.display.MovieClip;
    	import flash.events.Event;
    	import flash.utils.setTimeout;
    	
    	public class CustomMc extends MovieClip{
    		[Inspectable(type="String",defaultValue="who are you?")]
    		public var message:String;
    		
    		[Inspectable(type="List",defaultValue="a",enumeration ="a,b,c,d")]
    		public var id:String;
    		
    		[Inspectable(type="List",defaultValue="-1",enumeration ="-1,1")]
    		public var dir:int;
    		
    		[Inspectable(name = "激活属性", variable = "enabledProperty",type="Boolean",defaultValue=false)]
    		public var enabledProperty:Boolean;
    		
    		public function CustomMc(){
    			this.addEventListener(Event.ENTER_FRAME,enterFrame);
    		}
    		
    		private function enterFrame(e:Event):void{
    			this.removeEventListener(Event.ENTER_FRAME,enterFrame);
    			trace("message:"+message, "id:"+id, "dir:"+dir, "enabledProperty:"+enabledProperty);
    			/**
    			* 勾选"激活属性",输出:message:who are you? id:a dir:-1 enabledProperty:true
    			* 必须改变定义的属性中的任意一项为非默认值,所有的自定义默认值才生效,
    			* 否则获取得到的值就是as3各类型的默认值,以上如果不勾选"激活属性"和不改变其它项就
    			* 输出:message:null id:null dir:0 enabledProperty:false
    			*/
    
    		}
    
    	};
    	
    }
    

      

  • 相关阅读:
    走亲访友
    分而治之
    红色警报
    小字辈
    最长对称子串
    树的遍历
    acwing练习
    组合计数
    同余
    乘法逆元
  • 原文地址:https://www.cnblogs.com/kingBook/p/4980050.html
Copyright © 2011-2022 走看看