A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Timer / "screensaver" function across multible frames

  1. #1
    Junior Member
    Join Date
    Jun 2008
    Location
    denmark
    Posts
    7

    Timer / "screensaver" function across multible frames

    Hi Flash KIT useres.

    I am working on a instore touchscreen solution for customers. It build across multible frames with basic navigation videos ect.
    I would like to add a timer + event on each frame tracking if the application is idling for lets say 5 min on one frame then I want to send it back to the "start menu" frame 1.

    The code I have is this;

    import flash.utils.Timer;
    import flash.events.*;

    var inactiveTime1:int = 300000;
    var t1:Timer = new Timer(inactiveTime1);
    stage.addEventListener(MouseEvent.MOUSE_DOWN, timerReset1);
    t1.addEventListener(TimerEvent.TIMER, onTimer1);
    t1.start();
    function timerReset1(e:MouseEvent):void {
    t1.reset();
    t1.start();
    }
    function onTimer1(e:TimerEvent):void {
    handleInactivity1();
    }
    function handleInactivity1():void {
    gotoAndPlay(1);
    t1.removeEventListener(TimerEvent.TIMER, onTimer1);
    }
    The functions timers are named continiously throughout the frames ect. t1,t2,t2 ...
    The problem is when I navigate quickly through the frames with the other navigation buttons it seams like the timerfunctions or timer is
    not removed from the frames and releases even though the user is still active..

    I tested it in smaler scale with 3 frames and it seams to have the same issue.
    I dont know if I remove the timer properly or what the solutions it to this.
    Can somebody help me solve this issue?

  2. #2
    Junior Member
    Join Date
    Jun 2008
    Location
    denmark
    Posts
    7
    Found a solution by using class at following link http://evolve.reintroducing.com/2008...seidlemonitor/
    Pretty neat )

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