A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Timer question

  1. #1
    Senior Member
    Join Date
    Nov 2006
    Posts
    162

    Smile Timer question

    How would I get a timer function to reset after no buttons were pressed for 3 minutes?

    Right now I have my timer starting on load, and then when a button is pressed, it stops it. I basically want to restart it after 3 minutes.

    the code I have:

    PHP Code:
    var timer:Timer = new Timer(5000);
    timer.addEventListener(TimerEvent.TIMERplaySlides);
    timer.start();

    function 
    playSlides(event:Event):void{
        var 
    i:Number Math.round(Math.random()*slideinfo.length());
    loader.load(new URLRequest(xml.slide[i].@data));
    caption.text xml.slide[i].@caption;  

    then the timer.stop(); attached to the buttons...

    thanks

  2. #2
    Total Universe Mod jAQUAN's Avatar
    Join Date
    Jul 2000
    Location
    Honolulu
    Posts
    2,429
    Just have the function containing the stop() change the delay value instead.


    function handleRelease(event:Event):void{
    timer.delay = 1000 * 60 * 3; //this will restart the timer at its current interval
    }

  3. #3
    Senior Member
    Join Date
    Nov 2006
    Posts
    162
    HI jaquan, thanks for your reply.

    There is one thing I dont understand. When I use the function, it keeps the timer delay to 3 minutes, instead of restarting it to its 3 seconds slideshow.

    Should I define another set of timer? I am not sure how to do it?

    Thanks!

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center