Link to home
Start Free TrialLog in
Avatar of cavemantoyboy
cavemantoyboy

asked on

How to create timeout for touchscreen kiosk programmed Flash

Hi,

I have created a simple touch screen kiosk in flash that will be used to access food recipes.  

Users click through a series of menus and sub-menus to narrow down their search to a few recipes in their preferred area.  Theses menus are separated into scenes with buttons linking back and forth between these scenes.

I need a script that will take the flash back to the home screen after 90 seconds if nothing is pressed.  This will allow a new user to jump into the program from the beginning and not where the last person left it.

Solutions very much valued and appreciated. Cheers.
Avatar of TanLiHao
TanLiHao
Flag of Singapore image

See code snippet. The timer class is not exactly accurate but it should be fine for your software, if you want the 90 seconds to be really accurate, consider getTimer() or Date Class.

var nothingispressed:Boolean = true; // make sure you add nothingispressed = true when some button is pressed.
var timer:Timer = new Timer(90000, 1);
timer.addEventListener(TimerEvent.TIMER, updateTime);
timer.start();
 
function updateTime(e:TimerEvent):void
{
        if(nothingispressed) {
		// now jump back to beginning, add your own code.
	}
}

Open in new window

Avatar of cavemantoyboy
cavemantoyboy

ASKER

Hi, I just copied and pasted the code into the first frame of the flash file.  Nothing happened.  What am I supposed to add to the code.  I'm very new at actionscipt so perhaps you can fill it in with an example and I'll replace it with the correct "Names".  Am I supposed to copy this script to the beginning of all scenes, or just the first scene the swf starts on?
ASKER CERTIFIED SOLUTION
Avatar of cavemantoyboy
cavemantoyboy

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial