下面是5个示范希望对你有帮助 你打的那个有点不太懂 1:AS判断双击事件 var i:Number = 0; var times:Number = 0; _root.onEnterFrame = function () { time = time_txt; num_txt=i }; //判断时间 function dbclick(mcname):Void { mcname.onPress = function() { i++; if (i == 1) { var olddelaytime:Number = getTimer(); trace("第一时间:"+olddelaytime); } if (i == 2) { var delaytime:Number = getTimer(); trace("第二时间:"+delaytime); if (delaytime-olddelaytimedelay_txt = delaytime-olddelaytime; times++; times_txt = times; } else { delay_txt = "超时..."; } i = 0; trace("第"+i+"次"); } }; } dbclick(btnformc); 2:纯AS时钟 _root.createEmptyMovieClip("second_mc", 1); _root.createEmptyMovieClip("time_mc", 2); _root.createEmptyMovieClip("hours_mc", 3); _root.createTextField("hours_txt", 4, 80, 110, 50, 50); _root.createTextField("time_txt", 5, 95, 110, 50, 50); _root.createTextField("second_txt", 6, 110, 110, 50, 50); second_mc._x = time_mc._x=hours_mc._x=100; second_mc._y = time_mc._y=hours_mc._y=100; second_mc.lineStyle(1, 0x999999, 100); time_mc.lineStyle(1, 0x000000, 100); hours_mc.lineStyle(1, 0x000000, 100); second_mc.lineTo(0, -70); time_mc.lineTo(0, -60); hours_mc.lineTo(0, -50); function getdate() { mydata = new Date(); time = mydata.getMinutes(); second = mydata.getSeconds(); hours = mydata.getHours(); second_mc._rotation = second*6; time_mc._rotation = time*6; hours_mc._rotation = hours*30+time/2; hours_txt.text = hours; time_txt.text = time; second_txt.text = second; if(int(hours_txt.text)<10){ hours_txt.text="0"+hours+":" }else{hours_txt.text = hours+":"} if(int(second_txt.text)<10){ second_txt.text="0"+second }else{second_txt.text = second} if(int(time_txt.text)<10){ time_txt.text="0"+time+":" }else{time_txt.text=time+":"} }; setInterval(getdate,1000) 3:纯ASloading stop(); //初始化变量 var lineX = new Number(Stage.width/2); var lineY = new Number(Stage.height/2); //trace("lineX: "+lineX) //trace("lineY: "+lineY) //建立line函数 function createLine(mcname, color, alpha, x1, y1, x2, y2, depths) { //line的名称,颜色,透明度,四方形的x和y点坐标,景深 mc = createEmptyMovieClip(mcname, depths); mc.lineStyle(1, color, alpha); mc.beginFill(color, 100); mc.lineTo(x1, y2); mc.lineTo(x1, y1); mc.lineTo(x2, y1); mc.lineTo(x2, y2); mc.endFill(); } //建立文本函数 function createTxt(txtName, mydepths, x, y, width, height, myText) { createTextField(txtName, mydepths, x, y, width, height); with (eval(txtName)) { text = myText; //border = true; selectable = false; } } //初始化所有数据 createTxt("mytxt", 3, 0, 0, 35, 18, 0); createLine("line_mc", 0x0000ff, 100, 100, 50, 0, 0, 1); createLine("line2_mc", 0xff0000, 100, 90, 5, 0, 0, 2); mytxt._x = lineX-5; mytxt._y = lineY+5; line_mc._x = lineX-50; line_mc._y = lineY-25; line2_mc._x = line_mc._x+5; line2_mc._y = line_mc._y+line_mc._height/2-2; //建立加载情况 _root.onEnterFrame = function() { var myCur = new Number(int(_root.getBytesLoaded())); var myTol = new Number(int(_root.getBytesTotal())); var loadNum = new Number(int(myCur/myTol)*100); trace("现在读取的字节: "+myCur) trace("总的字节: "+myTol) trace("百分比: "+loadNum) mytxt.text = loadNum+"%"; line2_mc._xscale=loadNum //这里可以继续扩展其它功能. if (myCur>=myTol) { //判断加载情况 mytxt.text="" line_mc.removeMovieClip() line2_mc.removeMovieClip() gotoAndPlay(2); delete _root.onEnterFrame; } }; 4:AS小数判断 function aaa(a:Number, b:Number, c:Number):Number { return (Math.round(a / b * Math.pow(10, c)) / Math.pow(10, c)); } trace(aaa(63, 13, 2)); 5:纯AS射击无界面开发 stop(); Mouse.hide(); var mySoundArray:Array = new Array("sound1", "sound2", "sound3"); var mySound:Sound = new Sound(); var wrongtotal:Number=0; var righttotal:Number=0; function mouseAttack():Void { var rootmouse:MovieClip = new MovieClip(); this.attachMovie("mouse", "rootmouse",-1); this.rootmouse._x = _xmouse; this.rootmouse._y = _ymouse; startDrag("rootmouse"); } function randomMovie():Void { var timelists = 5; _global.textNum = new Number(random(3)+1); var rootmytextmc:MovieClip = new MovieClip(); this.attachMovie("mytextmc", "rootmytextmc", 1); i++ this.rootmytextmc._x = random(200)+100; this.rootmytextmc._y = random(200)+50; this.rootmytextmc.mytext.text = textNum; hitAlarm(); timelist(); } function hitAlarm():Void { _root.rootmytextmc.onRelease = function() { if (_root.rootmytextmc.hitTest(_root.rootmouse)) { this.removeMovieClip(); SoundPlay(); right(); randomMovie(); } }; } function timelist():Void { var mytime = Math.floor(getTimer()/1000); _root.onEnterFrame = function() { var nowtime = Math.floor(getTimer()/1000); var time = nowtime-mytime; _root.rootmytextmc.mytime._xscale = 100-(time/5*100) if (nowtime-mytime>=5) { delete onEnterFrame; _root.rootmytextmc.removeMovieClip(); wrong(); randomMovie(); } }; } function SoundPlay():Void { mySound.attachSound(mySoundArray[textNum-1]); mySound.start(); } function wrong():Void { wrongtotal++; this.wrong_txt.text = wrongtotal; } function right():Void { righttotal++; this.right_txt.text = righttotal; } mouseAttack(); randomMovie();