var test=0; txt_mc.stop(); var i; var waittime= Math.floor(getTimer()/1000); function count(){ var runtime= Math.floor(getTimer()/1000); var my = runtime- waittime; time_txt.text=my; } var timeCount=setInterval(count,500); p1_sc.addEventListener("mouseDown",mousedown); p2_sc.addEventListener("mouseDown",mousedown); p3_sc.addEventListener("mouseDown",mousedown); p4_sc.addEventListener("mouseDown",mousedown); p5_sc.addEventListener("mouseDown",mousedown); p6_sc.addEventListener("mouseDown",mousedown); function mousedown(me:MouseEvent){ me.currentTarget.startDrag(true); } p1_sc.addEventListener("mouseUp",mouseup); p2_sc.addEventListener("mouseUp",mouseup); p3_sc.addEventListener("mouseUp",mouseup); p4_sc.addEventListener("mouseUp",mouseup); p5_sc.addEventListener("mouseUp",mouseup); p6_sc.addEventListener("mouseUp",mouseup); function mouseup(me:MouseEvent){ me.currentTarget.stopDrag(); for(i=0;i<6;i++){ if ((me.currentTarget.x<=this.getChildAt(i).x+40) && (me.currentTarget.x>=this.getChildAt(i).x-40) && (me.currentTarget.y<=this.getChildAt(i).y+40) && (me.currentTarget.y>=this.getChildAt(i).y-40)) { me.currentTarget.x =this.getChildAt(i).x; me.currentTarget.y =this.getChildAt(i).y; if ((this.getChildAt(i).name=="p1_mc") && (me.currentTarget.name=="p1_sc")) test++; if ((this.getChildAt(i).name=="p2_mc") && (me.currentTarget.name=="p2_sc")) test++; if ((this.getChildAt(i).name=="p3_mc") && (me.currentTarget.name=="p3_sc")) test++; if ((this.getChildAt(i).name=="p4_mc") && (me.currentTarget.name=="p4_sc")) test++; if ((this.getChildAt(i).name=="p5_mc") && (me.currentTarget.name=="p5_sc")) test++; if ((this.getChildAt(i).name=="p6_mc") && (me.currentTarget.name=="p6_sc")) test++; trace(test); } } if (test==6) { txt_mc.gotoAndStop(2); clearInterval(timeCount); } }
>即時新聞-熱門
2008年10月26日星期日
拼圖設計–getTimer()
发帖者 ALEX 时间: 10:33
订阅:
博文评论 (Atom)
1 评论:
你好
我剛學flash
也想做拼圖遊戲
但我看不懂第四部分的第二點
能不能解說一下@@
謝謝~
发表评论