作者sxazdc (没啥好说的!)
看板Flash
标题[问题] 用flash制作掷骰子的ActionScript
时间Sun Nov 13 13:32:09 2011
目前在制作一个掷骰子的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)
1F:→ luchiwei:if(fred+ethel==7) 11/13 21:09