Time out function when no mouse clicks or mouse holds detected
Hi All,
Is there anything that i can add/remove to/from the following code to make it not timeout while the mouse button is being held down too?
i have tried to modify Harry's code with the following:
import mx.utils.Delegate;
btn1.onPress = function(){
clearTimeout();
}
btn2.onPress = function(){
clearTimeout();
}
btn1.onMouseUp = function(){
clearTimeout(nTimeoutId);
setUserActivityTimeout()
};
btn2.onMouseUp = function(){
clearTimeout(nTimeoutId);
setUserActivityTimeout()
};
btn1.onMouseDown = function(){
clearTimeout(nTimeoutId);
setUserActivityTimeout()
};
btn2.onMouseDown = function(){
clearTimeout(nTimeoutId);
setUserActivityTimeout()
};
function setUserActivityTimeout():Void
{
clearTimeout(nTimeoutId)
nTimeoutId = setTimeout(Delegate.create(this, onUserInactivity), nTimeTolerance);
}
function stopTimer():Void
{
clearTimeout(nTimeoutId)
}
function onUserInactivity():Void
{
delete_root.onMouseUp;
gotoAndStop("exit_no");
}
Ned - im not skilled in programming enough to follow through with your advice:
"Look into disabling the timer until a mouse up event occurs."
something like:
if
MouseEvent.press == true
then
clearTimeout(nTimeoutId)
????\
Pat