HITTEST + ROLLOVER + _xMOUSE?

Please help.

I have a sliding menu that works fine. However I only want it to scroll when the mouse is over it. But everything I have tried causes errors.

The menu is in 2 parts, a mask “box” and the slider “slider”.
The sider knows where the edges are from the box as below.
[AS]
top_y = _root.box._y;
bottom_y = top_y-(this._height-_root.box._height);
[/AS]

So how can I set it up so that it only moves when the mouse is over the box ? The complete code below.
[AS]
onClipEvent (load) {
ycenter = 175;
speed = .1;
top_y = _root.box._y;
bottom_y = top_y-(this._height-_root.box._height);
}
onClipEvent (enterFrame) {
var distance = _root._ymouse-ycenter;
_y -= (distance*speed);
if (this._y>=top_y) {
this._y = top_y;
} else if (this._y<=bottom_y) {
this._y = bottom_y;
}
}
[/AS]

Any help or pointers as I am at a dead end, thanks.

and you tried hittest or are you asking if thats an option? I think I would take that route. I assume the box bounding box is where you want to it to be active? just hitTest for that with _root._xmouse and _root._ymouse.

Thanks

I tried to use hittest but I’m not sure how to implement it ie: exactly where to put it and how to script it.

[AS]if (hitTest( _root._xmouse, _root._ymouse, false));[/AS]

itd probably be something like this:
[AS]
onClipEvent (load) {
ycenter = 175;
speed = .1;
top_y = _root.box._y;
bottom_y = top_y-(this._height-_root.box._height);
}
onClipEvent (enterFrame) {
if (_root.box.hitTest( _root._xmouse, _root._ymouse, false)){
var distance = _root._ymouse-ycenter;
_y -= (distance*speed);
if (this._y>=top_y) {
this._y = top_y;
} else if (this._y<=bottom_y) {
this._y = bottom_y;
}
}
}
[/AS]

Then the enterFrame actions will only be called if the mouse is in the box.

worked like a charm. Much appreciated.

great! :slight_smile: