作者loveminnie (minnie)
看板Flash
标题[问题] 时钟按下暂停显示时间
时间Mon Apr 1 13:08:37 2013
大家好
又来PO文想请教大家了> <"
我做了一个时钟旁边设置了一个暂停按钮
希望可以按下按钮时时钟停住并显示时间
有点类似码表的功能
但是遇到了一点小问题> <
1.时间在12点整左右时会显示变成0时_分,
不过过一下又会变12时_分,我希望能一直是显示12时_分。
2.我希望我在按一下按钮时间开始跑的时候,原本显示的时间能变成空白的
我有打上tel.text="";不知道是不是哪里出错了都不会变空白><
以上两点希望大大们能够帮帮我
附上新手制作的程式码~谢谢大家
import flash.events.MouseEvent;
var tag:int=0;
tag_btn.addEventListener(MouseEvent.CLICK,tag_move);
function tag_move(e:MouseEvent):void{
if(tag==0){
tag_btn.gotoAndStop(2);
tag=1;
sec_needle.stop();
hr_ned.stop();
}
else{
tag_btn.gotoAndStop(1);
tag=0;
sec_needle.play();
hr_ned.play();
tel.text="";
tel2.text="";
}
if(sec_needle.needle1.rotation<0){
tel.text=String(Math.round(60-(Math.abs(sec_needle.needle1.rotation)/6)));
if(Math.floor(hr_ned.currentFrame/60)==0){
tel2.text="12"; }
else{
tel2.text=String(Math.floor(hr_ned.currentFrame/60));
}
}
else{
tel.text=String(Math.round(sec_needle.needle1.rotation/6));
tel2.text=String(Math.floor(hr_ned.currentFrame/60));
}
trace(Math.round(sec_needle.needle1.rotation)/6)
trace(Math.floor(hr_ned.currentFrame/60));
}
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 60.244.53.3
1F:推 zpl:暂停跟开始跑是同一个按钮? 这样的话需要做一个判断开始或暂停 04/01 14:03
2F:→ loveminnie:对呀是同一个按钮,请问tag_btn算是判断暂停跟开始吗 04/01 17:05
3F:→ zpl:可以利用tag来做分辨状态 例0:尚未开始,1:计时中,2:暂停中 04/01 19:14
4F:→ zpl:当点下按钮时 若tag为0 就不要再判断後面的目前时间 04/01 19:17