废话不多说,直接上代码
package action
{
import fl.controls.Button;
import flash.display.Loader;
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.IOErrorEvent;
import flash.events.MouseEvent;
import flash.events.TimerEvent;
import flash.media.Sound;
import flash.media.SoundChannel;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.utils.Timer;
public class findspot extends Sprite
{
var level:Number = 1;
var totalscore:Number = 0;
var all:Button=new Button();
var now:Button=new Button();
var time:Button=new Button();
var level1:Button=new Button();
var nextbtn:Button=new Button();
var back2:Button=new Button();
var save_btn:Button=new Button();
var showlist_btn:Button=new Button();
var restart_btn:Button=new Button();
var flag1:Boolean = false;
var flag2:Boolean = false;
var flag3:Boolean = false;
var flag4:Boolean = false;
var flag5:Boolean = false;
var lx1:Number,ly1:Number,rx1:Number,ry1:Number;
var lx2:Number,ly2:Number,rx2:Number,ry2:Number;
var lx3:Number,ly3:Number,rx3:Number,ry3:Number;
var lx4:Number,ly4:Number,rx4:Number,ry4:Number;
var lx5:Number,ly5:Number,rx5:Number,ry5:Number;
var xml:XML=new XML();
var loader:URLLoader;
var myLoader1:Loader;
var myLoader2:Loader;
var url:URLRequest = new URLRequest("picturedata.xml");
var score:Number = 0;
var mytimer:Timer;
var ft:TextFormat;
var tf:TextField;
var finish_txt:MovieClip;
var namdu:int = 0;
var t:int = namdu;
var zhe:MovieClip;
var con:MovieClip=Util.getSymbol("congratulation");
var bar:MovieClip=Util.getSymbol("progressbar");
var a5:MovieClip;
var b5:MovieClip;
var a4:MovieClip;
var b4:MovieClip;
var a1:MovieClip;
var b1:MovieClip;
var a2:MovieClip;
var b2:MovieClip;
var a3:MovieClip;
var b3:MovieClip;
var fm:TextFormat;
var welcome_txt:TextField;
var simple:Button;
var normal:Button;
var difficult:Button;
var start_btn:Button;
var len:Number;
var music:Sound=Util.getSymbol("backmusic");
var win:Sound=Util.getSymbol("winmusic");
var lose:Sound=Util.getSymbol("losemusic");
var ready:Sound=Util.getSymbol("readymusic");
var chl:SoundChannel=new SoundChannel();
var myLoaderb:Loader;
var shuoming:TextField;
public function findspot()
{
setbackground();
welcome();
}
function welcome()
{
con.visible = false;
chl.stop();
//开始游戏欢迎页面
chl = ready.play(0,1000);
bar.x = 1210;
bar.y = 600;
bar.width = 20;
bar.height = 600;
welcome_txt=new TextField();
welcome_txt.text = "找茬小游戏";
welcome_txt.width = 1200;
welcome_txt.height = 200;
welcome_txt.x = 300;
welcome_txt.y = 100;
fm=new TextFormat();
fm.color = 0xff0000;
fm.size = 100;
fm.font = "方正胖头鱼简体";
fm.letterSpacing = 20;
welcome_txt.setTextFormat(fm);
addChild(welcome_txt);
start_btn=new Button();
start_btn.x = 500;
start_btn.y = 300;
start_btn.width = 200;
start_btn.height = 100;
start_btn.label = "开始游戏";
ft = new TextFormat();
ft.size = 40;
start_btn.setStyle("textFormat",ft);
addChild(start_btn);
simple=new Button();
simple.label = "简单";
simple.x = 350;
simple.y = 500;
simple.width = 100;
simple.height = 60;
ft=new TextFormat();
ft.size = 24;
simple.setStyle("textFormat",ft);
addChild(simple);
normal=new Button();
normal.label = "中等";
normal.x = 550;
normal.y = 500;
normal.width = 100;
normal.height = 60;
ft=new TextFormat();
ft.size = 24;
normal.setStyle("textFormat",ft);
addChild(normal);
difficult=new Button();
difficult.label = "困难";
difficult.x = 750;
difficult.y = 500;
difficult.width = 100;
difficult.height = 60;
ft=new TextFormat();
ft.size = 24;
difficult.setStyle("textFormat",ft);
addChild(difficult);
start_btn.enabled = false;
simple.addEventListener(MouseEvent.CLICK,setsimple);
normal.addEventListener(MouseEvent.CLICK,setnormal);
difficult.addEventListener(MouseEvent.CLICK,setdifficult);
start_btn.addEventListener(MouseEvent.CLICK,startgame);
}
function setsimple(e:MouseEvent):void
{
namdu = 40;
start_btn.enabled = true;
simple.enabled = false;
normal.enabled = true;
difficult.enabled = true;
}
function setnormal(e:MouseEvent):void
{
namdu = 30;
start_btn.enabled = true;
simple.enabled = true;
normal.enabled = false;
difficult.enabled = true;
}
function setdifficult(e:MouseEvent):void
{
namdu = 20;
start_btn.enabled = true;
simple.enabled = true;
normal.enabled = true;
difficult.enabled = false;
}
function hs(e:Event):void
{
//初始化找茬界面函数
readpic();
mytimer.start();
}
function setbackground()
{
myLoaderb=new Loader();
var imgb:String = "pic/background.jpg";
var picLinkb:URLRequest = new URLRequest(imgb);
myLoaderb.load(picLinkb);
addChild(myLoaderb);
myLoaderb.x = -300;
myLoaderb.y = -200;
setChildIndex(myLoaderb ,0);
myLoaderb.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,IOHander);
}
function IOHander(evt:Event):void{
trace("图片不存在");
}
function readpic()
{
//读取图片数据并显示两张图片
xml = XML(loader.data);
myLoader1=new Loader();
myLoader2=new Loader();
//读取图片
var img1:String = "pic/pic" + level + ".jpg";
var picLink1:URLRequest = new URLRequest(img1);
var img2:String = "pic/pic" + level + level + ".jpg";
var picLink2:URLRequest = new URLRequest(img2);
myLoader1.load(picLink1);
myLoader2.load(picLink2);
//舞台显示图片,两幅图片;
addChild(myLoader1);
myLoader1.x = 0;
myLoader1.y = 0;
setChildIndex(myLoader1 ,1);
addChild(myLoader2);
myLoader2.x = 600;
myLoader2.y = 0;
setChildIndex(myLoader2 ,1);
myLoader1.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,IOHander);
myLoader2.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,IOHander);
//分析xml数据,获取并储存茬点,每幅图5个点,分别储存;
var tmpxml = xml.descendants("profile")[level - 1];
len = xml.descendants("id").length();
lx1 = Number(tmpxml.descendants("one").descendants("l").split(",")[0]) + 600;
ly1 = Number(tmpxml.descendants("one").descendants("l").split(",")[1]);
rx1 = Number(tmpxml.descendants("one").descendants("r").split(",")[0]) + 600;
ry1 = Number(tmpxml.descendants("one").descendants("r").split(",")[1]);
lx2 = Number(tmpxml.descendants("two").descendants("l").split(",")[0]) + 600;
ly2 = Number(tmpxml.descendants("two").descendants("l").split(",")[1]);
rx2 = Number(tmpxml.descendants("two").descendants("r").split(",")[0]) + 600;
ry2 = Number(tmpxml.descendants("two").descendants("r").split(",")[1]);
lx3 = Number(tmpxml.descendants("three").descendants("l").split(",")[0]) + 600;
ly3 = Number(tmpxml.descendants("three").descendants("l").split(",")[1]);
rx3 = Number(tmpxml.descendants("three").descendants("r").split(",")[0]) + 600;
ry3 = Number(tmpxml.descendants("three").descendants("r").split(",")[1]);
lx4 = Number(tmpxml.descendants("four").descendants("l").split(",")[0]) + 600;
ly4 = Number(tmpxml.descendants("four").descendants("l").split(",")[1]);
rx4 = Number(tmpxml.descendants("four").descendants("r").split(",")[0]) + 600;
ry4 = Number(tmpxml.descendants("four").descendants("r").split(",")[1]);
lx5 = Number(tmpxml.descendants("five").descendants("l").split(",")[0]) + 600;
ly5 = Number(tmpxml.descendants("five").descendants("l").split(",")[1]);
rx5 = Number(tmpxml.descendants("five").descendants("r").split(",")[0]) + 600;
ry5 = Number(tmpxml.descendants("five").descendants("r").split(",")[1]);
}
function startfindspot(evt:Event):void
{
//获取鼠标指针位置
var x:Number = stage.mouseX;
var y:Number = stage.mouseY;
//判断位置来确定是否是茬点
if ((x > lx1 && x < rx1) && (y > ly1 && y < ry1))
{
if (flag1==false)
{
score++;
now.label = "本关得分:" + score + "分";
addChild(a1);
addChild(b1);
a1.visible = true;
b1.visible = true;
a1.x = (lx1 + rx1) / 2;
a1.y = (ly1 + ry1) / 2;
b1.x = (lx1 + rx1) / 2 - 600;
b1.y = (ly1 + ry1) / 2;
b1.gotoAndPlay(1);
a1.gotoAndPlay(1);
flag1 = true;
}
}
else if ((x > lx2 && x < rx2) && (y > ly2 && y < ry2))
{
if (flag2==false)
{
score++;
now.label = "本关得分:" + score + "分";
addChild(a2);
addChild(b2);
a2.visible = true;
b2.visible = true;
a2.x = (lx2 + rx2) / 2;
a2.y = (ly2 + ry2) / 2;
b2.x = (lx2 + rx2) / 2 - 600;
b2.y = (ly2 + ry2) / 2;
b2..play();
a2.gotoAndPlay(1);
flag2 = true;
}
}
else if ((x > lx3 && x < rx3) && (y > ly3 && y < ry3))
{
if (flag3==false)
{
score++;
now.label = "本关得分:" + score + "分";
addChild(a3);
addChild(b3);
a3.visible = true;
b3.visible = true;
a3.x = (lx3 + rx3) / 2;
a3.y = (ly3 + ry3) / 2;
b3.x = (lx3 + rx3) / 2 - 600;
b3.y = (ly3 + ry3) / 2;
b3.play();
a3.play();
flag3 = true;
}
}
else if ((x > lx4 && x < rx4) && (y > ly4 && y < ry4))
{
if (flag4==false)
{
score++;
now.label = "本关得分:" + score + "分";
addChild(a4);
addChild(b4);
a4.visible = true;
b4.visible = true;
a4.x = (lx4 + rx4) / 2;
a4.y = (ly4 + ry4) / 2;
b4.x = (lx4 + rx4) / 2 - 600;
b4.y = (ly4 + ry4) / 2;
b4.play();
a4.play();
flag4 = true;
}
}
else if ((x > lx5 && x < rx5) && (y > ly5 && y < ry5))
{
if (flag5==false)
{
score++;
now.label = "本关得分:" + score + "分";
addChild(a5);
addChild(b5);
a5.visible = true;
b5.visible = true;
a5.x = (lx5 + rx5) / 2;
a5.y = (ly5 + ry5) / 2;
b5.x = (lx5 + rx5) / 2 - 600;
b5.y = (ly5 + ry5) / 2;
b5.play();
a5.play();
flag5 = true;
}
}
//如果本关得到5分,则显示下一关按钮,时间停止,累加总分。
if (score==5)
{
var pos = chl.position;
chl.stop();
win.play();
var t:Timer = new Timer(4000,1);
t.addEventListener(TimerEvent.TIMER,dt);
function dt(e:TimerEvent):void
{
chl = music.play(pos,1000);
}
t.start();
//chl=music.play(pos,1000);
zhe=Util.getSymbol("zhegai");
zhe.alpha = 0.8;
zhe.x = -100;
zhe.y = -100;
zhe.width = 1600;
zhe.height = 800;
addChild(zhe);
totalscore = totalscore + score;
score = 0;
mytimer.stop();
addChild(con);
con.x = 600;
con.y = 200;
con.visible = true;
con.play();
nextbtn.x = 500;
nextbtn.y = 450;
nextbtn.height = 80;
nextbtn.width = 200;
nextbtn.label = "下一关";
ft=new TextFormat();
ft.size = 40;
ft.color = 0xff33cc;
ft.font = "方正少儿简体";
nextbtn.setStyle("textFormat",ft);
addChild(nextbtn);
}
}
function gameover()
{
tf=new TextField();
tf.text = "游戏结束";
tf.x = 450;
tf.y = 200;
tf.width = 400;
ft=new TextFormat();
ft.color = 0xff0000;
ft.size = 80;
ft.font = "方正胖头鱼简体";
tf.setTextFormat(ft);
addChild(tf);
tf=new TextField();
tf.x = 500;
tf.y = 300;
tf.width = 400;
tf.text = "一共玩了 " + level + " 关";
ft=new TextFormat();
ft.color = 0x000000;
ft.size = 24;
ft.font = "方正胖娃简体";
tf.setTextFormat(ft);
addChild(tf);
tf=new TextField();
tf.x = 500;
tf.y = 330;
tf.width = 400;
tf.text = "您的总得分 " + totalscore + " 分";
ft=new TextFormat();
ft.color = 0x000000;
ft.size = 24;
ft.font = "方正胖娃简体";
tf.setTextFormat(ft);
addChild(tf);
save_btn.label = "保存战绩";
save_btn.x = 500;
save_btn.y = 400;
save_btn.width = 180;
save_btn.height = 60;
ft=new TextFormat();
ft.size = 40;
ft.font = "微软雅黑";
save_btn.setStyle("textFormat",ft);
addChild(save_btn);
save_btn.addEventListener(MouseEvent.CLICK,savescore);
}
function savescore(e:Event):void
{
clearAll();
//setbackground();
var daming:TextField=new TextField();
daming.x = 450;
daming.y = 200;
daming.width = 200;
daming.height = 50;
daming.text = "您的尊名:";
ft=new TextFormat();
ft.color = 0x000000;
ft.size = 40;
ft.font = "楷体";
daming.setTextFormat(ft);
addChild(daming);
shuoming=new TextField();
shuoming.x = 450;
shuoming.y = 350;
shuoming.width = 200;
shuoming.height = 50;
shuoming.text = "请输入您的大名!";
ft=new TextFormat();
ft.color = 0xff0000;
ft.size = 24;
ft.font = "微软雅黑";
shuoming.setTextFormat(ft);
addChild(shuoming);
shuoming.visible = false;
finish_txt=Util.getSymbol("finish");
finish_txt.x = 450;
finish_txt.y = 250;
finish_txt.height = 80;
finish_txt.width = 300;
finish_txt.txt.condenseWhite = true;
addChild(finish_txt);
showlist_btn.label = "查看排行榜";
showlist_btn.x = 500;
showlist_btn.y = 400;
showlist_btn.width = 200;
showlist_btn.height = 80;
ft=new TextFormat();
ft.size = 35;
ft.font = "微软雅黑";
showlist_btn.setStyle("textFormat",ft);
addChild(showlist_btn);
showlist_btn.addEventListener(MouseEvent.CLICK,showlist);
finish_txt.txt.addEventListener(Event.CHANGE,inputchange);
}
function inputchange(e:Event):void
{
if (finish_txt.txt.text.charAt(finish_txt.txt.text.length - 1) == " ")
{
finish_txt.txt.text = finish_txt.txt.text.substring(0,finish_txt.txt.text.length - 1);
}
if (finish_txt.txt.text == "")
{
shuoming.visible = true;
}
else
{
shuoming.visible = false;
}
}
var zhanji:Array=new Array();
function showlist(e:Event):void
{
if (finish_txt.txt.text == "")
{
shuoming.visible = true;
}
else
{
clearAll();
//setbackground();
zhanji.push(new Person(finish_txt.txt.text,totalscore));
zhanji.sort(sortByScore);
tf=new TextField();
tf.width = 150;
tf.height = 50;
tf.x = 500;
tf.y = 100;
tf.text = "姓名";
ft=new TextFormat();
ft.color = 0x00ff00;
ft.font = "微软雅黑";
ft.size = 36;
tf.setTextFormat(ft);
addChild(tf);
tf=new TextField();
tf.width = 100;
tf.height = 50;
tf.x = 680;
tf.y = 100;
tf.text = "分数";
ft=new TextFormat();
ft.color = 0x00ff00;
ft.size = 36;
ft.font = "微软雅黑";
tf.setTextFormat(ft);
addChild(tf);
for (var i=zhanji.length-1; i>=0; i--)
{
tf=new TextField();
ft=new TextFormat();
ft.color = 0x000000;
ft.size = 30;
ft.font = "微软雅黑";
tf.x = 500;
tf.y = 100 + 50 * (zhanji.length- i);
tf.text = zhanji[i].getZname();
tf.setTextFormat(ft);
addChild(tf);
}
for (var j=zhanji.length-1; j>=0; j--)
{
tf=new TextField();
ft=new TextFormat();
ft.color = 0x000000;
ft.font = "微软雅黑";
ft.size = 30;
tf.x = 680;
tf.y = 100 + 50 * (zhanji.length -j);
tf.text = zhanji[j].getScore() + "";
tf.setTextFormat(ft);
addChild(tf);
}
restart_btn.label = "重新开始游戏";
restart_btn.x = 500;
restart_btn.y = 520;
restart_btn.width = 250;
restart_btn.height = 80;
ft=new TextFormat();
ft.size = 35;
ft.font = "微软雅黑";
restart_btn.setStyle("textFormat",ft);
restart_btn.addEventListener(MouseEvent.CLICK,restart);
addChild(restart_btn);
}
}
function restart(e:Event):void
{
clearAll();
welcome();
flag1 = false;
flag2 = false;
flag3 = false;
flag4 = false;
flag5 = false;
level = 1;
mytimer.stop();
t = namdu;
totalscore = 0;
score = 0;
//init();
//loader = new URLLoader(url);
//loader.addEventListener(Event.COMPLETE,hs);
}
function sortByScore(a:Person,b:Person):Number
{
var aScore:Number = a.getScore();
var bScore:Number = b.getScore();
if (aScore > bScore)
{
return 1;
}
else if (aScore < bScore)
{
return -1;
}
else
{
return 0;
}
}
function init()
{//初始化界面
clearAll();
a5=Util.getSymbol("circle");
b5=Util.getSymbol("circle");
a4=Util.getSymbol("circle");
b4=Util.getSymbol("circle");
a1=Util.getSymbol("circle");
b1=Util.getSymbol("circle");
a2=Util.getSymbol("circle");
b2=Util.getSymbol("circle");
a3=Util.getSymbol("circle");
b3=Util.getSymbol("circle");
a1.visible = false;
a2.visible = false;
a3.visible = false;
a4.visible = false;
a5.visible = false;
b1.visible = false;
b2.visible = false;
b3.visible = false;
b4.visible = false;
b5.visible = false;
a1.height = 30;
a2.height = 30;
a3.height = 30;
a4.height = 30;
a5.height = 30;
a1.width = 20;
a2.width = 20;
a3.width = 20;
a4.width = 20;
a5.width = 20;
b1.height = 30;
b2.height = 30;
b3.height = 30;
b4.height = 30;
b5.height = 30;
b1.width = 20;
b2.width = 20;
b3.width = 20;
b4.width = 20;
b5.width = 20;
addChild(bar);
addChild(all);
addChild(now);
addChild(time);
addChild(level1);
ft=new TextFormat();
ft.size = 16;
nextbtn.setStyle("textFormat",ft);
all.label = "总得分:" + totalscore + "分";
all.x = 300;
all.y = 625;
all.height = 50;
all.width = 150;
ft=new TextFormat();
ft.size = 20;
all.setStyle("textFormat",ft);
now.label = "本关得分:0分";
now.x = 450;
now.y = 625;
now.height = 50;
now.width = 150;
ft=new TextFormat();
ft.size = 20;
now.setStyle("textFormat",ft);
t = namdu;
time.label = "倒计时:" + t + "秒";
time.x = 150;
time.y = 625;
time.height = 50;
time.width = 150;
ft=new TextFormat();
ft.size = 20;
time.setStyle("textFormat",ft);
mytimer = new Timer(1000,t);
level1.label ="第" + level + "关";
level1.x = 0;
level1.y = 625;
level1.height = 50;
level1.width = 150;
ft=new TextFormat();
ft.size = 20;
level1.setStyle("textFormat",ft);
var des_txt:TextField=new TextField();
des_txt.text = "请找出两幅图像不同的地方";
des_txt.x = 620;
des_txt.y = 625;
des_txt.width = 350;
var strFormat:TextFormat=new TextFormat();
strFormat.color = 0xff0000;
strFormat.size = 24;
strFormat.font = "楷体";
des_txt.setTextFormat(strFormat);
addChild(des_txt);
mytimer.addEventListener(TimerEvent.TIMER,ontime);
mytimer.start();
//监听点击,开始找茬;
stage.addEventListener(MouseEvent.CLICK,startfindspot);
//下一关按钮
nextbtn.addEventListener(MouseEvent.CLICK,nextlevel);
}
function startgame(evt:Event):void
{
//点击进入游戏
chl.stop();
chl = music.play(0,1000);
init();
loader = new URLLoader(url);
loader.addEventListener(Event.COMPLETE,hs);
}
function ontime(e:TimerEvent):void
{//倒计时按钮控制
t--;
time.label = "倒计时:" + t + "秒";
bar.height = 600 / namdu * t;
if (t==0)
{
var pos = chl.position;
chl.stop();
lose.play();
var t1:Timer = new Timer(4000,1);
t1.addEventListener(TimerEvent.TIMER,dt1);
function dt1(e:TimerEvent):void
{
chl = music.play(pos,1000);
}
t1.start();
stage.removeEventListener(MouseEvent.CLICK,startfindspot);
mytimer.stop();
totalscore = totalscore + score;
clearAll();
//setbackground();
gameover();
}
}
function nextlevel(evt:Event):void
{//下一关
if (len==level)
{
stage.removeEventListener(MouseEvent.CLICK,startfindspot);
mytimer.stop();
clearAll();
//setbackground();
gameover();
}
else
{
addChild(bar);
flag1 = false;
flag2 = false;
flag3 = false;
flag4 = false;
flag5 = false;
level++;
mytimer.stop();
t = namdu;
//init();
a1.visible = false;
a2.visible = false;
a3.visible = false;
a4.visible = false;
a5.visible = false;
b1.visible = false;
b2.visible = false;
b3.visible = false;
b4.visible = false;
b5.visible = false;
a5=Util.getSymbol("circle");
b5=Util.getSymbol("circle");
a4=Util.getSymbol("circle");
b4=Util.getSymbol("circle");
a1=Util.getSymbol("circle");
b1=Util.getSymbol("circle");
a2=Util.getSymbol("circle");
b2=Util.getSymbol("circle");
a3=Util.getSymbol("circle");
b3=Util.getSymbol("circle");
a1.visible = false;
a2.visible = false;
a3.visible = false;
a4.visible = false;
a5.visible = false;
b1.visible = false;
b2.visible = false;
b3.visible = false;
b4.visible = false;
b5.visible = false;
a1.height = 30;
a2.height = 30;
a3.height = 30;
a4.height = 30;
a5.height = 30;
a1.width = 20;
a2.width = 20;
a3.width = 20;
a4.width = 20;
a5.width = 20;
b1.height = 30;
b2.height = 30;
b3.height = 30;
b4.height = 30;
b5.height = 30;
b1.width = 20;
b2.width = 20;
b3.width = 20;
b4.width = 20;
b5.width = 20;
removeChild(myLoader1);
removeChild(myLoader2);
all.label = "总得分:" + totalscore + "分";
now.label = "本关得分:0分";
time.label = "倒计时:" + t + "秒";
level1.label ="第" + level + "关";
removeChild(nextbtn);
removeChild(con);
removeChild(zhe);
loader = new URLLoader(url);
loader.addEventListener(Event.COMPLETE,hs);
}
}
function clearAll():void
{
while (this.numChildren > 1)
{
this.removeChildAt(1);
}
}
}
}
package action
{
import flash.display.Sprite;
public class Person extends Sprite
{
private var zname:String;
private var score:Number;
public function Person(zname:String, score:Number)
{
this.zname = zname;
this.score = score;
}
public function getScore():Number
{
return score;
}
public function getZname():String
{
return zname;
}
override public function toString():String
{
return " " + zname + ":" + score;
}
}
}
package action
{
import flash.system.ApplicationDomain;
import flash.utils.getDefinitionByName;
public class Util
{
/**
* 返回元件的实例
* @param className 元件的导出类名 String类
* @return 返回元件的实例
*/
public static function getSymbol(className:String,domain:ApplicationDomain = null):*{
if(domain == null){
domain = ApplicationDomain.currentDomain;
}
if(domain.hasDefinition(className)){
var cls:Class = domain.getDefinition(className) as Class;
return new cls;
}else{
trace(className+" 未找到");
}
return null;
}
}
}
等等上图。。。。。

本文深入探讨了游戏开发领域的核心技术,包括Unity3D、Cocos2d-X、游戏引擎、AR和VR技术,以及游戏程序、游戏美术和游戏策划等方面的知识。
5324

被折叠的 条评论
为什么被折叠?



