Skip navigation
Stewart TVDSB
Currently Being Moderated

How to track clients idle time and force to Login View

Jun 10, 2013 8:42 AM

Tags: #flex-mobile #as3 #flex4.5

How can I force clients to the Login View after a period of idle time ( 1 hour). My mobile application consist of many views and need  the time out to work from any view. Your assistance is appreciated.Using Flash Builder 4.5 and AS 3.0.

 

I was able to make it work using FlexEvent.Idle to determine the inactivity. But it only works when I am on the second view, if I go deeper (third view) it fails. Here is the code I am using and the error I get

 

 

 

protected function view1_creationCompleteHandler(event:FlexEvent):void

  {

     this.systemManager.addEventListener(FlexEvent.IDLE, userIdle);

  }

 

 

 

private function userIdle(e:FlexEvent):void

  {

   if(e.currentTarget.mx_internal::idleCounter == 200)

   {

    //do something!

   

    navigator.popToFirstView();

   }

  }

 

ERROR MESSAGE

++++++++++++++++++++++++

  • TypeError: Error #1009: Cannot access a property or method of a null object reference.
  • at views::MainMenu/userIdle()[C:\Documents and Settings\spences\Adobe Flash Builder 4.5\EmployeeLogin\src\views\MainMenu.mxml:89]
    • at flash.events::EventDispatcher/dispatchEventFunction()

    • at flash.events::EventDispatcher/dispatchEvent()

    • at mx.managers::SystemManager/idleTimer_timerHandler()[E:\dev\4.5.1\fram eworks\projects\framework\src\mx\managers\SystemManager.as:3292]

    • at flash.utils::Timer/_timerDispatch()

     

at flash.utils::Timer/tick()

 

Message was edited by: Stewart TVDSB

 

More Like This

  • Retrieving data ...

Bookmarked By (1)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points