I have a horizontal text menu that has a small graphic under
it that slides horizontally to the menu item you rollover. The code
is straightforward:
—————-
stop();
Button_AboutUs.onRollOver = function() {
Nav_Slider.xMove = Button_AboutUs._x;
};
Button_OurWork.onRollOver = function() {
Nav_Slider.xMove = Button_OurWork._x;
};
Button_ClientList.onRollOver = function() {
Nav_Slider.xMove = Button_ClientList._x;
};
Button_Contact.onRollOver = function() {
Nav_Slider.xMove = Button_Contact._x;
};
—————
The sliding graphic “Nav_Slider” has this code attached to it
directly:
—————
onClipEvent (load) {
xMove = _x;
easeSpeed = 5;
}
onClipEvent (enterFrame) {
_x += (xMove-_x)/easeSpeed;
}
——————–
That all works fine, but what I noticed is that the tracer
graphic will just stay under the last menu item I roll over once I
move the mouse away from the navigation, so I wanted to have the
tracer graphic return to its default position if a navigation menu
item was not rolled over within say a 2 second time period. So I
thought I could add code like this:
——————–
Button_AboutUs.onRollOut = setTimeout(Nav_Slider_Reset, 2000,
“2 second delay”);
Button_OurWork.onRollOut = setTimeout(Nav_Slider_Reset, 2000,
“2 second delay”);
Button_ClientList.onRollOut = setTimeout(Nav_Slider_Reset,
2000, “2 second delay”);
Button_Contact.onRollOut = setTimeout(Nav_Slider_Reset, 2000,
“2 second delay”);
function Nav_Slider_Reset() {
Nav_Slider.xMove = 0;
}
——————–
But that doesn’t appear to work. Any help would be
appreciated.|||
I think it’s just that you have the form wrong:
>>Button_AboutUs.onRollOut =
setTimeout(Nav_Slider_Reset, 2000, “2 second
>>delay”);
Should be:
Button_AboutUs.onRollOut = function(){
setTimeout(Nav_Slider_Reset, 2000);
}
–
Dave -
www.offroadfire.com
Head Developer
http://www.blurredistinction.com
Adobe Community Expert
http://www.adobe.com/communities/experts/
|||
Actually you should probably include the onReleaseOutside in
there:
Button_AboutUs.onRollOut = Button_AboutUs.onReleaseOutside =
function(){
setTimeout(Nav_Slider_Reset, 2000);
}
–
Dave -
www.offroadfire.com
Head Developer
http://www.blurredistinction.com
Adobe Community Expert
http://www.adobe.com/communities/experts/
|||
Hi Dave- that solved the problem, but opened up a new one. I
notice now that when I preview my movie and rollover the first nav
button the tracer stays in place, but once I rollout and rollover
another nav button the tracer does follow to the other button, but
within the 2 second interval of rollingout of the first button it
will return to it’s default position even though I’m still
rolledover on another button. I think it’s constantly trying to run
my Nav_Slider_Reset function because I’ve rolledout of the first
button regardless of it being rolledover on another button. My
guess is I need to somehow incorporate the clearTimeout Function
now- this is what I tried but it doesn’t work:
stop();
Button_AboutUs.onRollOver = function() {
clearTimeout(ns_timedProcess);
Nav_Slider.xMove = Button_AboutUs._x;
};
Button_AboutUs.onRollOut =
Button_AboutUs.onReleaseOutside=function () {
var ns_timedProcess:Number = setTimeout(Nav_Slider_Reset,
4000);
};
Button_OurWork.onRollOver = function() {
clearTimeout(ns_timedProcess);
Nav_Slider.xMove = Button_OurWork._x;
};
Button_OurWork.onRollOut =
Button_OurWork.onReleaseOutside=function () {
var ns_timedProcess:Number = setTimeout(Nav_Slider_Reset,
4000);
};
Button_ClientList.onRollOver = function() {
clearTimeout(ns_timedProcess);
Nav_Slider.xMove = Button_ClientList._x;
};
Button_ClientList.onRollOut =
Button_ClientList.onReleaseOutside=function () {
var ns_timedProcess:Number = setTimeout(Nav_Slider_Reset,
4000);
};
Button_Contact.onRollOver = function() {
clearTimeout(ns_timedProcess);
Nav_Slider.xMove = Button_Contact._x;
};
Button_Contact.onRollOut =
Button_Contact.onReleaseOutside=function () {
var ns_timedProcess:Number = setTimeout(Nav_Slider_Reset,
4000);
};
function Nav_Slider_Reset() {
Nav_Slider.xMove = 0;
}
|||
Anyone else have an idea?
Related posts:
- Button Navigation & Highlight Problem
- problem on rollOver event in as2
- on rollover make image alpha 100%
- RollOver hover timing issue
- Combobox + mp3 player
Related posts brought to you by Yet Another Related Posts Plugin.