777拉霸範例

barPic1_mc.gotoAndStop(1);
barPic2_mc.gotoAndStop(2);
barPic3_mc.gotoAndStop(3);

stop_btn.enabled=false;
var numArray:Array=new Array();
start_btn.addEventListener(MouseEvent.CLICK,dostart);
function dostart(e:MouseEvent):void {
 barPic1_mc.play();
 barPic2_mc.play();
 barPic3_mc.play();
 winning_mc.gotoAndStop(1);
 stop_btn.enabled=true;
}

 

stop_btn.addEventListener(MouseEvent.CLICK,dostop);


function dostop(e:MouseEvent):void {

 for (var i:int=1; i<=3; i++) {

  var num=Math.floor(Math.random()*6+1);
  numArray[i-1]=num;
  stop_bar(i,num);
 }
 
 if (numArray[0]==numArray[1]&&numArray[2]==numArray[1]) {
  winning_mc.gotoAndStop(num);
 }

}


function stop_bar(i,num){
switch (i) {
  case 1 :
   barPic1_mc.gotoAndStop(num);
   break;
  case 2 :
   barPic2_mc.gotoAndStop(num);
   break;
  case 3 :
   barPic3_mc.gotoAndStop(num);
   break;
 }
}

創作者介紹

Genie's Space G妮的小世界

G妮 發表在 痞客邦 PIXNET 留言(0) 人氣()