Copy link to clipboard
Copied
Hello:
I have one principal menu with six buttons, each button open (in a loader) new menues flash movies, one of them flash movie, for example, has 20 buttons each button open in a loader a new movie. I need to detect inactivity for ten minutes for example and come back to the principal menu. Do I have tu put the code in all movies or there is a way tu put only in the movie with 20 buttons?
thank you very much
Copy link to clipboard
Copied
your main swf can detect events in all loaded swfs. so, if you wanted to detect 10min mouse inactivity, in your main swf:
var t:Timer=new Timer(10000,0);
t.addEventListener(TimerEvent.TIMER,timeoutF);
t.start();
this.addEventListener(MouseEvent.MOUSE_MOVE,moveF);
function moveF(e:MouseEvent):void{
t.reset();
t.start()
}
function timeoutF(e:TimerEvent):void{
// do whatever because of mouse inactivity
}
Copy link to clipboard
Copied
Thank you very much.
How can remove the timer when finish?
I have used removeEventListener and don't stop the timer.
many thanks
Copy link to clipboard
Copied
if you no longer need the timer after one timeout, use:
var t:Timer=new Timer(10000,0);
t.addEventListener(TimerEvent.TIMER,timeoutF);
t.start();
this.addEventListener(MouseEvent.MOUSE_MOVE,moveF);
function moveF(e:MouseEvent):void{
t.reset();
t.start()
}
function timeoutF(e:TimerEvent):void{
// do whatever because of mouse inactivity
t.removeEventListener(TimerEvent.TIMER,timeoutF);
t=null;
}
Copy link to clipboard
Copied
Thanks again.
I have other question:
I am in the main swf and a second, third... swf are loaded, when the timer is over how can I remove this second, third... swf and come back to main swf?
Other one If I am in the main swf and the timer is over how can I stay in the main swf?
Many many thanks to you.
Copy link to clipboard
Copied
Hello:
I have another problem, when I load new swf and move mouse in the loaded swf the timer continue don't reset.
thanks
Copy link to clipboard
Copied
1. to unload a loaded swf, apply unloadAndStop(), if you're publishing for fp10+, to the loader or unload().
2. to reset the timer, apply reset() to the timer. to restart the timer, apply start() to the timer. both are showing in moveF()