当前位置: 首页 > 图文教程 > Flash动画 > Flash动画制作 > Flash MX 编程深层次应用-Flash射击游戏(7)

Flash动画制作
Flash的事件机制:从AsBroadcaster到EventDispatcher
Flash脚本的执行顺序
完全掌握AS中点(.)语法的应用
抗日Flash集之:万里长城永不倒
抗日Flash集之:地道战
抗日Flash集之:抗日新闻
抗日Flash集之:三一八惨案
抗日Flash集之:五四运动
抗日Flash集之:抗日一隅
抗日Flash集之:血染的风采
抗日Flash集之:淞沪抗战
抗日Flash集之:终日到底
抗日Flash集之:东京功略战[游戏]
抗日Flash集之:大中华·1937
抗日Flash集之:长征
抗日Flash集之:抗日宣言
抗日Flash集之:血战钓鱼岛
用Flash MX制作MOV短片
用flash打开本地文件夹
Flash打造迷你特色音乐播放器

Flash动画制作 中的 Flash MX 编程深层次应用-Flash射击游戏(7)


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-22   浏览: 99 ::
收藏到网摘: n/a

6.3 游戏后台通信(1)

    

6.3.1  游戏积分排行榜

一个完整的游戏都有一个排行榜,本游戏也不例外。排行榜的内容实际上就是将玩家的得分及姓名等相应内容向后台程序发送,然后由后台程序进行处理,再将处理完的结果返回中。下面先看看游戏的前台部分,如图6-22所示。

6-22

Ö           1帧:取得积分榜

程序如下:

_root.input_name._visible = false;

_root.now_over._visible = true;

stopDrag();

Mouse.show();

stopAllSounds();

//这里的url设为本地的,可以根据需要改正真实的值

url = "http://localhost/";

_root.now_url = url+"./score.asp?buf="+getTimer();

_root.reply_time = 15;

dongua_load_var = new LoadVars();

         

dongua_load_var.sendAndLoad(_root.now_url, dongua_load_var, "POST");

function time_out() {

    clearInterval(get_first);

    gotoAndPlay("disp_all_fen");

    removeMovieClip(_root["dongua"]);

}

get_first = setInterval(time_out, _root.reply_time*1000);

_root.createEmptyMovieClip("dongua", 1);

_root.dongua.onEnterFrame = function() {

    if (dongua_load_var.loaded) {

             //如果已经有返回就不再计时

             clearInterval(get_first);

&nb