我的方法其實很傻瓜,就是次選單的出現是用遮罩,
次選單一開始不在遮罩範圍內,看不見也不會成為滑鼠的觸摸範圍。
語法如下>>
//import TweenLite import com.greensock.*; import com.greensock.plugins.*; TweenPlugin.activate([TintPlugin]); //設定滑鼠摸到menu_1的事件 menu_1.addEventListener(MouseEvent.MOUSE_OVER,doOver1); function doOver1(e:MouseEvent):void { TweenLite.to(menu_1.sub_menu_mask, 1, {scaleY:155}); TweenLite.to(menu_1.sub_bg, 0.5, {alpha:1}); TweenLite.to(menu_1.txt, 0.5, {tint:0xffff00}); } //設定滑鼠離開menu_1的事件 menu_1.addEventListener(MouseEvent.MOUSE_OUT,doOut1); function doOut1(e:MouseEvent):void { TweenLite.to(menu_1.sub_menu_mask, 0.5, {scaleY:1}); TweenLite.to(menu_1.sub_bg, 0.5, {alpha:0}); TweenLite.to(menu_1.txt, 0.5, {tint:null}); } menu_2.addEventListener(MouseEvent.MOUSE_OVER,doOver2); function doOver2(e:MouseEvent):void { TweenLite.to(menu_2.sub_menu_mask, 1, {scaleY:155}); TweenLite.to(menu_2.sub_bg, 0.5, {alpha:1}); TweenLite.to(menu_2.txt, 0.5, {tint:0xffff00}); } menu_2.addEventListener(MouseEvent.MOUSE_OUT,doOut2); function doOut2(e:MouseEvent):void { TweenLite.to(menu_2.sub_menu_mask, 0.5, {scaleY:1}); TweenLite.to(menu_2.sub_bg, 0.5, {alpha:0}); TweenLite.to(menu_2.txt, 0.5, {tint:null}); } menu_3.addEventListener(MouseEvent.MOUSE_OVER,doOver3); function doOver3(e:MouseEvent):void { TweenLite.to(menu_3.sub_menu_mask, 1, {scaleY:155}); TweenLite.to(menu_3.sub_bg, 0.5, {alpha:1}); TweenLite.to(menu_3.txt, 0.5, {tint:0xffff00}); } menu_3.addEventListener(MouseEvent.MOUSE_OUT,doOut3); function doOut3(e:MouseEvent):void { TweenLite.to(menu_3.sub_menu_mask, 0.5, {scaleY:1}); TweenLite.to(menu_3.sub_bg, 0.5, {alpha:0}); TweenLite.to(menu_3.txt, 0.5, {tint:null}); }
0 意見:
張貼留言