Help

I have a topbar image that changes color based on the mouse position in the fla. The code someone gave me works, but everywhere in the fla. I only want the topbar image to play when the mouse moves hor. across a menu bar).

this is what i’m using.

onClipEvent(load){
gotoAndStop(1);
}

onClipEvent(enterFrame){
goto = Math.round(_root._xmouse/10);

gotoAndStop(goto);
}

The topbar is a mc with the color change keyframed over 60 frames.

someone suggested

if (_root._xmouse >= 10 || _root._xmouse <= 100) {
// any movieClip action you want
}

I don’t have any idea how to incorperate this code into my original code. Also, what do the numbers mean associated with mouse position.
i.e. (_xmouse >= 10)

thanks for any help

first i would say change the || [size=1]logical or[/size] operator to && [size=1]short-circuit AND[/size] operator

if (_root._xmouse >= 10 || _root._xmouse <= 100) {
if (_root._xmouse >= 10 && _root._xmouse <= 100) {

then i guess it would be something like this:

onClipEvent (enterFrame) {
	if (_root._xmouse >= 10 && _root._xmouse <= 100) {
		goto = Math.round(_root._xmouse/10);
		this.gotoAndStop(goto);
	}
}

or

onClipEvent (enterFrame) {
	if (_root.menubarInstanceName.hitTest(_root._xmouse, _root._ymouse, true)) {
		goto = Math.round(_root._xmouse/10);
		this.gotoAndStop(goto);
	}
}

by the way …
[color=red]<=[/color] less than or equal to
[color=red]>=[/color] greater than or equal to

hope it helps :slight_smile:

that was very helpful and clear. thanks.

my only question are the numbers associated with mouse position like _xmouse = 10 etc. Is 10 a pixle position???

thanks