【转】ActionScript中如何随机生成验证码
1 var ran:Number;
2 var code:String;
3 var checkcode:String="";
4 var num:Number;
5 for(var i:int=0;i<4;i++){
6 ran=Math.random();
7 num=Math.round(ran*10000);
8 if(num%2==0)
9 code=String.fromCharCode(48+(num%10));
10
11 else
12 code=String.fromCharCode(65+(num%26));
13
14 checkcode +=code;
15 }
16 return checkcode;