View Full Version : timing movie clips
zerosignal0
September 2nd, 2004, 08:33 PM
Hello,
Ok I am making a menu that opens up on mouse rollover and I cant really figure out how to make the script to close it after a few seconds if they havent moved the mouse inside of it... I know that last sentence might not make alot of sense but Im basically just trying to make the menu move back to its original spot if the mouse hasnt rolled over it in 5 seconds. Can anyone point me in the right direction?
thanks
zerosignal0
September 3rd, 2004, 02:58 PM
so no one knows what Im talking about?
stringy
September 3rd, 2004, 04:05 PM
so no one knows what Im talking about?
try something like this
function getoldX() {
oldX = _xmouse;
clearInterval(Int1);
}
function checkMouse() {
if (Math.abs(_xmouse-oldX<5) && Math.abs(_ymouse-oldY<5)) {
trace("close");
clearInterval(myInterval);
} else {
oldX = _xmouse;
oldY = _ymouse;
}
}
mc.onRollOver = function() {
trace("open");
myInterval = setInterval(checkMouse, 5000);
Int1 = setInterval(getoldX, 100);
};
mc.onRollOut = function() {
clearInterval(myInterval);
};
won`t give you exactly 5seconds but should be ok for what you want
zerosignal0
September 3rd, 2004, 09:48 PM
try something like this
function getoldX() {
oldX = _xmouse;
clearInterval(Int1);
}
function checkMouse() {
if (Math.abs(_xmouse-oldX<5) && Math.abs(_ymouse-oldY<5)) {
trace("close");
clearInterval(myInterval);
} else {
oldX = _xmouse;
oldY = _ymouse;
}
}
mc.onRollOver = function() {
trace("open");
myInterval = setInterval(checkMouse, 5000);
Int1 = setInterval(getoldX, 100);
};
mc.onRollOut = function() {
clearInterval(myInterval);
};
won`t give you exactly 5seconds but should be ok for what you want
thanks for the response but the code you provided has a problem... I inserted the code and changed it to match my movie clip name but Im getting a type mismatch error
**Error** Scene=Scene 8, layer=actions, frame=47:Line 7: Type mismatch.
if (Math.abs(_xmouse-oldX<5) && Math.abs(_ymouse-oldY<5)) {
Total ActionScript Errors: 1 Reported Errors: 1
any ideas?
stringy
September 4th, 2004, 01:51 AM
thanks for the response but the code you provided has a problem... I inserted the code and changed it to match my movie clip name but Im getting a type mismatch error
**Error** Scene=Scene 8, layer=actions, frame=47:Line 7: Type mismatch.
if (Math.abs(_xmouse-oldX<5) && Math.abs(_ymouse-oldY<5)) {
Total ActionScript Errors: 1 Reported Errors: 1
any ideas?
sorry, try this
function getoldX() {
oldX = _xmouse;
clearInterval(Int1);
}
function checkMouse() {
if (Math.abs(_xmouse-oldX)<5 && Math.abs(_ymouse-oldY)<5) {
trace("close");
clearInterval(myInterval);
} else {
oldX = _xmouse;
oldY = _ymouse;
}
}
mc.onRollOver = function() {
trace("open");
myInterval = setInterval(checkMouse, 5000);
Int1 = setInterval(getoldX, 100);
};
mc.onRollOut = function() {
clearInterval(myInterval);
};
zerosignal0
September 4th, 2004, 09:09 AM
lol
ok no errors now but whenever I rollover my mc it just pops up open on the output box while Im live previewing it... hmm... Im trying to work on it but Im not familiar with a couple of the commands so I dont know if Im going to be able to figure this one out on my own.
stringy
September 4th, 2004, 10:52 AM
lol
ok no errors now but whenever I rollover my mc it just pops up open on the output box while Im live previewing it... hmm... Im trying to work on it but Im not familiar with a couple of the commands so I dont know if Im going to be able to figure this one out on my own.
all you have to do is replace the traces with a call to the function(s) which open/close your menu.
zerosignal0
September 4th, 2004, 06:21 PM
all you have to do is replace the traces with a call to the function(s) which open/close your menu.
function getoldX() {
oldX = _xmouse;
clearInterval(Int1);
}
function checkMouse() {
if (Math.abs(_xmouse-oldX)<5 && Math.abs(_ymouse-oldY)<5) {
_root.nav.gotoAndPlay("down");
clearInterval(myInterval);
} else {
oldX = _xmouse;
oldY = _ymouse;
}
}
nav.onRollOver = function() {
_root.nav.gotoAndPlay("up");
myInterval = setInterval(checkMouse, 5000);
Int1 = setInterval(getoldX, 100);
};
nav.onRollOut = function() {
clearInterval(myInterval);
};
well for some reason its still not working so hears what Im putting in. I just cant seem to figure it out... now nothing happens
stringy
September 4th, 2004, 08:00 PM
function getoldX() {
oldX = _xmouse;
clearInterval(Int1);
}
function checkMouse() {
if (Math.abs(_xmouse-oldX)<5 && Math.abs(_ymouse-oldY)<5) {
_root.nav.gotoAndPlay("down");
clearInterval(myInterval);
} else {
oldX = _xmouse;
oldY = _ymouse;
}
}
nav.onRollOver = function() {
_root.nav.gotoAndPlay("up");
myInterval = setInterval(checkMouse, 5000);
Int1 = setInterval(getoldX, 100);
};
nav.onRollOut = function() {
clearInterval(myInterval);
};
well for some reason its still not working so hears what Im putting in. I just cant seem to figure it out... now nothing happens
if you upload your fla, i`ll see if i can sort it out for you
zerosignal0
September 5th, 2004, 12:07 AM
cool Id really appriciate it man
http://www.zerosignaldesigns.com/fla.zip
stringy
September 5th, 2004, 05:45 AM
cool Id really appriciate it man
http://www.zerosignaldesigns.com/fla.zip
can you upload a version without my code which is working . I`m unclear how you are going to use your rollOvers/rollOuts with nav.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.