Results 1 to 2 of 2

Thread: Timer With hitTest

  1. #1
    Join Date
    Feb 2008
    Posts
    90
    Thanks
    3
    Thanked 2 Times in 2 Posts

    Default Timer With hitTest

    I am having many problems trying to get my timer working correctly using as2. I want the timer to start when the movie enters the second frame, the person watching the movie needs to see the timer incrementing, like a score, and then to stop once a hitTest has been detected.
    Help is appreciated.
    Thanks.

  2. #2
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    The timer (will increase "seconds" by 1 every second):
    Code:
    var seconds:Number = 0;
    function addTime() {
      seconds++;
      trace(seconds + " seconds have elapsed")
    }
    
    var interval = setInterval(addTime, 1000);
    To shut it off:
    Code:
    clearInterval(interval);

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •