Skip to main content
mauricem91902475
Participating Frequently
June 7, 2022
Pregunta

Idle mode sceensaver time out for desktop web app

  • June 7, 2022
  • 1 respuesta
  • 419 visualizaciones

I'm building an interactive desktop web app with different menus and videos that will be accessed via URL and presented on a large format touchscreen. I have a startup screen that is a movieclip symbol with some animation - user taps screen to flick through the interactive app. I need help creating a timeout code to return the app to the initial state after 2 minutes of inactivity (no touch/mouse movement or gestures).

 

I did find in discussions code that works but it seems to only work for Air Apps and not desktop. Any help would be much appreciated as I'm relatively new to code.

https://community.adobe.com/t5/animate-discussions/idle-mode-sceensaver-time-out-for-android-app-intrractive/m-p/12169305

 

Tks

    Este tema ha sido cerrado para respuestas.

    1 respuesta

    JoãoCésar17023019
    Community Expert
    Community Expert
    June 7, 2022

    Hi.

     

    Sorry for missing your question on the other topic.

     

    The code for the HTML5 Canvas document could be something like this:

     

    var root = this;
    var delay = 5000;
    var timeout = 0;
    
    function main()
    {
    	root.stop();
    	root.startButton.on("click", start);
    	anim_container.addEventListener("mousedown", wake);
    	anim_container.addEventListener("mousemove", wake);
    }
    
    function start(e)
    {
    	root.gotoAndStop(1);
    }
    
    function wake(e)
    {
    	clearTimeout(timeout);
    	timeout = setTimeout(idle, delay);
    }
    
    function idle()
    {
    	root.gotoAndStop(0);
    }
    
    main();

     

     

    I hope it helps.

     

    Regards,

    JC

    mauricem91902475
    Participating Frequently
    June 7, 2022

    Hi JC,

    That works perfect!! Really appreaciated.

    Many thanks,

    M

     

     

    JoãoCésar17023019
    Community Expert
    Community Expert
    June 7, 2022

    Awesome, M! You're welcome!