這應該是一個關於movieClip的感應區的問題
在AS3中要多設一個mouseEnabled的屬性
對動態文字跟movieClip都有效
[沒有設定mouseEnabled]
[設定mouseEnabled後]
完整程式碼:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | package { import flash.display.*; import flash.events.*; import flash.utils.Timer; import caurina.transitions.Tweener; import caurina.transitions.properties.ColorShortcuts; ColorShortcuts.init(); public class Main extends Sprite { var textTxt:TextMc = new TextMc(); var biruArr:Array=new Array("","ビル1","ビル2","ビル3"); public function Main() { btn_biru1.buttonMode=true; btn_biru1.addEventListener(MouseEvent.MOUSE_OVER,biru_over); btn_biru1.addEventListener(MouseEvent.MOUSE_OUT,biru_out); btn_biru2.buttonMode=true; btn_biru2.addEventListener(MouseEvent.MOUSE_OVER,biru_over); btn_biru2.addEventListener(MouseEvent.MOUSE_OUT,biru_out); btn_biru3.buttonMode=true; btn_biru3.addEventListener(MouseEvent.MOUSE_OVER,biru_over); btn_biru3.addEventListener(MouseEvent.MOUSE_OUT,biru_out); Tweener.addTween(btn_biru1,{_brightness:-1}) Tweener.addTween(btn_biru2,{_brightness:-1}) Tweener.addTween(btn_biru3,{_brightness:-1}) stage.addEventListener(MouseEvent.MOUSE_MOVE,textMove); textTxt.alpha=0; textTxt.mouseEnabled=false; textTxt.main_txt.mouseEnabled=false; this.addChild(textTxt); } private function biru_over(e:MouseEvent) { e.target.gotoAndStop("over"); textTxt.main_txt.text=biruArr[e.target.name.charAt(8)]; Tweener.addTween(textTxt, {alpha:1 , time:0.5}); Tweener.addTween(e.target,{_brightness:-0.5,time:1,transition:"easeOutBack"}) } private function biru_out(e:MouseEvent) { e.target.gotoAndStop("out"); Tweener.addTween(e.target,{_brightness:-1,time:1,transition:"easeOutBack"}) Tweener.addTween(textTxt, {alpha:0 , time:0.5}); } private function textMove(e:MouseEvent) { Tweener.addTween(textTxt, {x:mouseX,y:mouseY , time:0.8 , transition:"easeOutQuint"}); } } } |
上個留言在我按下送出後…他(範例)出現了…厄…更不解…XD
恩 我的BLOG自動變成要回復才能看FLASH了嗎@@
不解…因為flash區塊我什麼都看不到哩