看板 Flash 關於我們 聯絡資訊
目前在製作一個擲骰子的Flash, 可否幫我看一下ActionScript中的if哪裡有錯誤? (fred是第一個骰子,etherl是第二個骰子) 有三個if, 第一個是當擲出兩個點數相同的骰子時,會出現"You won!"的文字; 第二個是當擲出兩個點數和為七的時候,會出現"You lose!"的文字; 第三個是既不是相同點數也不是七的時候,不會出現任何文字。 fred.stop(); ethel.stop(); fred.buttonMode=ethel.buttonMode=true; function rollDice(MouseEvent){ fred.gotoAndStop(Math.ceil(Math.random()*6)); ethel.gotoAndStop(Math.ceil(Math.random()*6)); if(fred==ethel){ doubles_txt.text="You won!"; } if(fred+ethel=7){ seven_txt.text="You lose!" }else{ doubles_txt.text=""; seven_txt.text=""; } } fred.addEventListener(MouseEvent.CLICK, rollDice); etherl.addEventListener(MouseEvent.CLICK, rollDice); 謝謝! ※ 編輯: sxazdc 來自: 75.13.92.16 (11/13 13:34) sxazdc:轉錄至看板 CodeJob 11/13 13:37 ※ 編輯: sxazdc 來自: 75.13.92.16 (11/13 14:01)
luchiwei:if(fred+ethel==7) 11/13 21:09