Contents
Articles
Behaviors
Books
Director News
Director Web Sites
FAQ
Games
Mailing Lists
News Groups
Project Examples
Reviews
Software
Tools
Useful Web Sites
Utilities
Xtras

Don't miss these
MPEGXtra
Progress Bar
Change the LineSize of a Shape Sprite
detecting hard disk
EZIO
Macromedia Flash 5 From Scratch
FreePPP Control
PrintOMatic
Clean for reinstall
Set Castmember properties for DirectMedia member
 

 

 

Behavior Multiple-timer facility

Added on 7/2/1999

 

Compatibilities:
D6_5 D7 D8 Mac PC Script

This item has not yet been rated

Author: Penworks (website)

Reproduced with permission from Penworks Lingo User"s Journal

-- Source Code from the Lingo User"s Journal
-- Copyright (c) 1995 by Penworks Corporation

on startMovie
  initTimer
  setTimer(#MusicTimer, seconds(15))
  SetTimer(#SoundTimer, seconds(30))
end startMovie

on stopMovie
  put "(stopped)"
  shutDownTimer
end stopMovie

on exitFrame
  if timerExpired(#MusicTimer) then
    put "Music timer expired"
    setTimer(#MusicTimer,seconds(20))
  end if
  if timerExpired(#SoundTimer) then
    put "Sound timer expired."
    killTimer(#SoundTimer)
  end if
  go to the frame
end exitFrame

-- Timer Services

global timerList

on seconds numSeconds
  -- Converts seconds to ticks, so you can refer to seconds(4) instead of 240 (4 * 60)
  return(numSeconds * 60)
end seconds

on timerExpired whichTimer
  -- Check to see if a given timer expired
  set expirationTime =getAProp(timerList, whichTimer)
  set expired =expirationTime and (getTimeCount() >= expirationTime)
  return(expired)
end timerExpired

on setTimer whichTimer, numTicks
  -- Set the expiration time of a timer
  set expirationTime =getTimeCount() + numTicks
  setAProp( timerList, whichTimer, expirationTime)
end setTimer

on killTimer whichTimer
  -- Force a timer to expire
  setAProp(timerList, whichTimer, 0)
end killTimer

on initTimer
  set timerList=[:]
end initTimer

on shutDownTimer
end shutDownTimer

on getTimeCount
  return the ticks
end getTimeCount

 


Contact

MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA

Send e-mail