• 设置 menu 菜单 监听


            //设置 menu菜单监听			
    		public  function addMenuListener(selectedBtn:String):void{
    			
    			for(var i:int = 1;i< 5;i++){				
    				if( this.menu["menuBtn"+i] !=  null){									 
    				   this.menu["menuBtn"+i].buttonMode = true;														
    				   this.menu["menuBtn"+i].mouseChildren = false;														
    				   this.menu["menuBtn"+i].mouseEnabled = true;														
    				   this.menu["menuBtn"+i].gotoAndStop(1);																       
    				   this.menu["menuBtn"+i].addEventListener(MouseEvent.CLICK, onMenuBtnClick);				
    				   this.menu["menuBtn"+i].addEventListener(MouseEvent.ROLL_OVER, onMenuBtnMouseOver);				
    				   this.menu["menuBtn"+i].addEventListener(MouseEvent.ROLL_OUT, onMenuBtnMouseOut);								   				   
    				}else{
    					trace("没有找到这个元件!");
    				}
    			}							
    			//选中状态				   
    			this.menu[selectedBtn].removeEventListener(MouseEvent.CLICK, onMenuBtnClick);				
    			this.menu[selectedBtn].removeEventListener(MouseEvent.ROLL_OVER, onMenuBtnMouseOver);				
    			this.menu[selectedBtn].removeEventListener(MouseEvent.ROLL_OUT, onMenuBtnMouseOut);												   
    			this.menu[selectedBtn].gotoAndStop(10);																				
    			
    		}		
    		//提示按钮  移动上去  显示提示框 
    		private function onMenuBtnMouseOver(event:MouseEvent):void {										
    			event.currentTarget.gotoAndPlay(2);															
    		}
    		//提示按钮  移动上去  显示提示框 
    		private function onMenuBtnMouseOut(event:MouseEvent):void {					
    			event.currentTarget.gotoAndStop(1);												
    		}		
    		//提示按钮点击之后  弹出panel
    		private function onMenuBtnClick(event:MouseEvent):void {           
    			//获取 btn的编号   尾号作为图片arr的序列
    		  	//var btnNum:int = event.currentTarget.name.charAt(3);								
    			trace("点击的是:"+event.currentTarget.name);			
    			
    			addMenuListener(event.currentTarget.name);		
    			
    			
    			/*if(event.currentTarget.name == "menuBtn1"){
    				
    				
    			}*/
    			
    		}
    

      

  • 相关阅读:
    zabbix 监控机器监听的端口 + 触发器 表达式理解
    php关于文件上传的两个配置项说明
    linux cron计划任务防止多个任务同时运行
    php注册自动加载函数
    linux 下查看机器是cpu是几核的
    laravel容器类make方法解释
    laravel php门面模式
    js获取当前页面的url地址
    php编码规范
    laravel console handle 传参方法
  • 原文地址:https://www.cnblogs.com/regalys168/p/4568020.html
Copyright © 2020-2023  润新知