/*design by whb in 2009-3-30 MOUSE_OVER:改变MC颜色,将鼠标改为手型,修改MC的透明度;MOUSE_OUT:将MC的属性复原;DOUBLE_CLICK:设置MC为不可见 */ package { import flash.display.MovieClip; import flash.events.MouseEvent; import flash.display.BlendMode; import flash.events.Event; public class Mc extends MovieClip { private var over_alpha:Number=.6; private var out_alpha:Number=1; public function Mc() { init(); } private function init():void { this.doubleClickEnabled=true; addEventListener(flash.events.MouseEvent.MOUSE_OVER,mouse_over); addEventListener(flash.events.MouseEvent.MOUSE_OUT,mouse_out); addEventListener(flash.events.MouseEvent.DOUBLE_CLICK,double_click); } private function mouse_over(e:MouseEvent) { this.useHandCursor=true; this.buttonMode=true; this.alpha=over_alpha; this.blendMode=BlendMode.SUBTRACT; } private function mouse_out(e:MouseEvent) { this.alpha=out_alpha; this.buttonMode=true; this.useHandCursor=false; this.blendMode=BlendMode.NORMAL; } public function double_click(e:MouseEvent) { this.visible=false; }
}
}
子类1:
/*design by whb in 2009-3-30 取消父类的双击事件相应 */ package { public class McSon extends Mc { public function McSon() { super(); this.doubleClickEnabled=false; }
}
}
子类2:
/*design by whb in 2009-3-30 重写双击事件,修改MC颜色 */ package { import flash.events.MouseEvent; import flash.geom.ColorTransform; import flash.geom.Transform; public clas