Search content:

 

Personal Menu
Username:
Password:
Save password

Become a member

Forgot Password?

 

Don't miss these
Mudbox
Bevel Static-Alphamania
cXtraSendMail
Connect 4
asASIOout
Sprite Stick To Mouse Cursor
ADisplay
Increase/ Decrease Digital Video Volume
Using Director 7 (Special Edition)
SQLite Xtra
MediaMacros Xtras Mall
 

 

 

Behavior UpDown Timer

Added on 6/7/1999

 

Compatibilities:
behavior D6_5 Mac PC

This item has not yet been rated

Author: PatMcClellan

NOTE: you may want to add a startMovie or endMovie handler which clears the actorList.

property pstartMin
property pstartSec
property pCountUp -- time up (1) or count down (0) (default is down)
property pStopTime -- a switch for the timer
property pSecNow
property pMinNow


on getPropertyDescriptionList
  set p_list = [ ¬
  #pCountUp: [ #comment: "Click for count UP:", ¬
  #format: #boolean, ¬
  #default:  0 ], ¬
  #pStartMin: [ #comment: "Starting Minutes:", ¬
  #format: #integer, ¬
  #default:  0 ,¬
  #range: [min:0,max:59]], ¬
  #pStartSec: [ #comment: "Starting Seconds:", ¬
  #format: #integer, ¬
  #default:  0,¬
  #range: [min:0,max:59]]¬
  ]
  return p_list
end

on beginSprite me
  set pStopTime = FALSE
  add the actorList, me
  if NOT pCountUp then
    set pStartMin = pStartMin - 1
    set pStartSec = pStartSec + 60
  end if
  startTimer
end

on stepFrame me
  if NOT pStopTime then
    if pCountUp then
      countUp me
    else
      countDown me
    end if
  end if
end

on countUp me
  set secondsElapsed = the timer/60
  set pSecNow = secondsElapsed mod 60
  set pMinNow = the timer/3600
  displayTime me
end

on countDown me
  set secondsElapsed = the timer/60
  set pSecNow = pStartSec - (secondsElapsed mod 60)
  set pMinNow = pStartMin - (the timer/3600)
  if pSecNow > 60 then
    set pMinNow = pMinNow + 1
    set pSecNow = pSecNow - 60
  end if
  displayTime me
  if pMinNow = 0 and pSecNow = 0 then
    set pStopTime = TRUE
  end if
end

on displayTime me
  if pSecNow = 60 then
    put pMinNow + 1 & ":00" into showTime
  else if pSecNow < 10 then
    put pMinNow & ":0" & pSecNow into showTime
  else
    put pMinNow & ":" & pSecNow into showTime
  end if
  put showTime into field "timer"
end

 


Upload Provided by ABCUpload ASP

Contact

MMI
22 West Court Sq
Suite 2C
Newnan, GA 30263
USA

Fax - (206) 339-5833

Send e-mail