1 / 9

伺服器程式實務期末作業

伺服器程式實務期末作業. 老師 : 楊政達 老師 學生 :499k0103_ 張浩琳. 操作. 點擊 CLICK 開始遊戲 在十秒內重複點擊 CLICK 結束後輸入名字並查看排行榜 按右下角 R 可重新開始遊戲. 程式. 影格 1. stop(); b2.addEventListener("click",st); function st(e:MouseEvent) { gotoAndPlay(2); }. 影格 2. var winNum:int=0; var num=0; var lt:int=10;

sonora
Télécharger la présentation

伺服器程式實務期末作業

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 伺服器程式實務期末作業 老師:楊政達 老師 學生:499k0103_張浩琳

  2. 操作 • 點擊CLICK開始遊戲 • 在十秒內重複點擊CLICK • 結束後輸入名字並查看排行榜 • 按右下角R可重新開始遊戲

  3. 程式 • 影格1 • stop(); • b2.addEventListener("click",st); • function st(e:MouseEvent) • { • gotoAndPlay(2); • }

  4. 影格2 • var winNum:int=0; • var num=0; • var lt:int=10; • var ltimer:Timer=new Timer(1000,10); • stop(); • b1.addEventListener(MouseEvent.CLICK,clickn); • function clickn(e:MouseEvent) • { • num++; • winNum++; • num_txt.text=String(num); • } • ltimer.start();

  5. ltimer.addEventListener(TimerEvent.TIMER,tt); • function tt(e:TimerEvent) • { • lt=lt-1; • lasttime.text=lt.toString(); • } • ltimer.addEventListener(TimerEvent.TIMER_COMPLETE,endd); • function endd(TimerEvent) • { • gotoAndPlay("end"); • }

  6. 影格3 • stop(); • getWin_mc.visible=false; • setWin_mc.visible=true; • gob.visible=true; • var connection:NetConnection; • var chkResponder:Responder; • var getResponder:Responder; • chkResponder = new Responder(onResultchk, onFault); • getResponder = new Responder(onResultget, onFault); • connection = new NetConnection; • var gateway:String = "/amfphp/gateway.php"; • connection.connect(gateway);

  7. function onResultchk(Result:int):void { if(Result==1) { setWin_mc.visible=true; getWin_mc.visible=false; }else{ setWin_mc.visible=false; getWin_mc.visible=true; connection.call("clickgame022.getWin",getResponder); } } function onResultget(Result:Object):void { setWin_mc.visible=false; getWin_mc.visible=true; var i=0; for (i=0;i<Result["totalWin"];i++) { getWin_mc["winName" + i + "_txt"].text=Result["winName" + i]; getWin_mc["winNum" + i + "_txt"].text=Result["winNum" + i]; } }

  8. function onFault(Result:String):void { trace("資料讀取錯誤!!"); } gob.addEventListener("click",yesClick); function yesClick(me:MouseEvent) { connection.call("clickgame022.setWin",null,setWin_mc.winName_txt.text,winNum); connection.call("clickgame022.getWin",getResponder); gob.visible=false; } rego.addEventListener("click",againClick); function againClick(e:MouseEvent) { gotoAndPlay(1); gob.visible=true; } connection.call("clickgame022.chkWin",chkResponder,winNum);

  9. <? • class clickgame022{ • var $userName = "root"; //帳號 • var $password = "111"; //密碼 • var $hostName = "localhost"; //主機(Server) • ?> PHP

More Related