[問題] mouseover

看板Flash作者 (空虛)時間16年前 (2009/07/15 11:29), 編輯推噓1(109)
留言10則, 2人參與, 最新討論串1/2 (看更多)
又來煩大家啦 這個範例照理說不是在滑鼠移到shape2的時候會讓shape1消失嗎? 可是程式碼也對,也有顯示圖片,就是移到shape2的時候shape1不會消失。 請問有知道原因嗎?謝謝。 var shape1:Shape = new Shape(); var shape2:Shape = new Shape(); shape1.graphics.beginFill(0xff0000); shape1.graphics.drawRect(0,0,200,100); shape1.graphics.endFill(); shape2.graphics.beginFill(0x00ff00); shape2.graphics.drawRect(100,100,200,100); shape2.graphics.endFill(); addChild(shape1); addChild(shape2); shape2.addEventListener(MouseEvent.MOUSE_OVER,over); shape2.addEventListener(MouseEvent.MOUSE_OVER,out); function over(e:MouseEvent) { removeChild(shape1); } function out (e:MouseEvent) { addChild(shape1); } -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 61.228.131.162

07/15 12:07, , 1F
因為Shape並不是InteractiveObject的小孩啊 :)
07/15 12:07, 1F

07/15 12:10, , 2F
那請問我該怎做呢?因為我是照書做的xd
07/15 12:10, 2F

07/15 12:10, , 3F
現在還在努力搞懂中
07/15 12:10, 3F

07/15 12:11, , 4F
建立一個container,例如sprite或movieclip,把shape
07/15 12:11, 4F

07/15 12:11, , 5F
丟進去(addChild)
07/15 12:11, 5F

07/15 12:23, , 6F
listener加在container上,應該就會動了
07/15 12:23, 6F

07/15 12:25, , 7F
@@ 好高深
07/15 12:25, 7F

07/15 12:27, , 8F
我現在只能做些簡單的東西
07/15 12:27, 8F

07/15 12:27, , 9F
那個套件跟類別還在努力中xd
07/15 12:27, 9F

07/15 12:28, , 10F
可以教一下怎加嗎@@
07/15 12:28, 10F
※ 編輯: skylight68 來自: 61.228.131.162 (07/15 12:28)
文章代碼(AID): #1ANKqfaJ (Flash)
討論串 (同標題文章)
文章代碼(AID): #1ANKqfaJ (Flash)