一個無理的請求

看板Flash作者 (浪跡天涯的宅神)時間17年前 (2008/04/26 01:48), 編輯推噓2(205)
留言7則, 2人參與, 最新討論串1/4 (看更多)
可以請各位大大幫我看看有哪裡做錯嗎? 我想用flash寫個動作遊戲, 但是試了一個小時都卡在莫名其妙的地方, 也不知道是語法錯誤還是整體架構的問題... ======================== 只有一個場景: scene 1 和一個物件: player player的第一影格是站立的動作; 2~5是攻擊的動畫; 並在1,2影格皆輸入stop(); scene1就只把player拉到畫面上,然後在唯一的影格輸入以下AS if (Key.isDown(Key.RIGHT)){ //如果按右鍵人物往右移 root.player._x ++ ; } If (Key.isDown(Key.c)){ //如果按c進入動畫 with(root.player) gotoandplay(2) } ======================================= 這樣寫到底有甚麼問題? -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 59.124.8.181 ※ 編輯: madturtle 來自: 59.124.8.181 (04/26 01:49)

04/26 02:10, , 1F
gotoAndPlay XD
04/26 02:10, 1F
補充一下, 出現的錯誤訊息: 1120: Access of undefined property Key. (if (Key.isDown(Key.RIGHT)){ ) 1119: Access of possibly undefined property player through a reference with static type flash.display:DisplayObject. (root.player._x ++ ; ) ※ 編輯: madturtle 來自: 59.124.8.181 (04/26 02:19)

04/26 13:24, , 2F
if (Key.isDown(Key.c)) 不是這樣用的
04/26 13:24, 2F

04/26 13:25, , 3F
這樣用的話,只會在那格被播放到的時候檢查一次
04/26 13:25, 3F

04/26 13:25, , 4F
而不是 "當有按鍵被按下的時候" 檢查
04/26 13:25, 4F
但是我的scene 1只有一個影格,不是等於一直在播這個影格嗎?

04/26 13:26, , 5F
還有一個更大的原因,你用AS3...是沒有Key這個class的
04/26 13:26, 5F

04/26 13:26, , 6F
要看補救辦法,請見4297篇
04/26 13:26, 6F

04/26 13:27, , 7F
詳細用法,請見回文
04/26 13:27, 7F
※ 編輯: madturtle 來自: 59.124.8.181 (04/26 15:33)
文章代碼(AID): #184XbKc1 (Flash)
文章代碼(AID): #184XbKc1 (Flash)