Copy link to clipboard
Copied
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.
Tks
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Hi JC,
That works perfect!! Really appreaciated.
Many thanks,
M
Copy link to clipboard
Copied
Awesome, M! You're welcome!
Copy link to clipboard
Copied
Hi,
I have added a 2 min video on Frame (70) which will play when a button is clicked from the home screen.
I'm trying to add an exception on the video frame (70) to prevent the root timer from returning to the homescreen after 1 minute. Ideally I'd also like the video to play and when finished return to home screen (0)
This is the code on the home screen:
var root = this;
var delay = 60000;
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 tried this but doesn't work:
this.video.addEventListener("onend", return1);
function return1()
{
this.gotoAndStop(0);
}
Any help appreciated
M
Find more inspiration, events, and resources on the new Adobe Community
Explore Now