看板 Flash 關於我們 聯絡資訊
大家好 又來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
zpl:暫停跟開始跑是同一個按鈕? 這樣的話需要做一個判斷開始或暫停 04/01 14:03
loveminnie:對呀是同一個按鈕,請問tag_btn算是判斷暫停跟開始嗎 04/01 17:05
zpl:可以利用tag來做分辨狀態 例0:尚未開始,1:計時中,2:暫停中 04/01 19:14
zpl:當點下按鈕時 若tag為0 就不要再判斷後面的目前時間 04/01 19:17