flash 随机函数

Math.floor(Math.random()*4); 随机产生一个0-4的随机数 下载fla文件下载swf文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
go_btn.addEventListener(MouseEvent.CLICK, augur);
function augur(me:MouseEvent){
    var rnd=Math.floor(Math.random()*4);
      
    if (rnd==0){
        msg_txt.text="^O^ 万事大利!";
    }else if (rnd==1){
        msg_txt.text="^_^ 喜气临门!";
    }else if (rnd==2){
        msg_txt.text="出入平安!";
    }else if (rnd==3){
        msg_txt.text="运势平平!";
    }
}




posted @ 2013-01-03 14:44  thero  阅读(349)  评论(0编辑  收藏  举报