Follow mouse with conditionals

Hi everyone:

I’ve done a navigation bar (actually there are 2 of them, one over another), and have a movie clip (a semi-transparent rectangle) that follows mouse. Each navigation bar has its own “follower”. The hard thing for me to figure out is to determine a range in Y axis that tells this semi-transparent rectangle to appear and disappear. Here is the code for the bottom MC:

[font=Courier New]onClipEvent (load) {[/font]
[font=Courier New]_x = 0;[/font]
[font=Courier New]speed = 8;[/font]
[font=Courier New]}[/font]

[font=Courier New]onClipEvent (enterFrame) {[/font]
[font=Courier New]endX = _root._xmouse;[/font]
[font=Courier New]endY = _root._ymouse;[/font]
[font=Courier New]_x += (endY - _x)/speed;[/font]

[font=Courier New]if (endY >= 230){[/font]
[font=Courier New]_root.follower2.gotoAndPlay(“rollover”)[/font]
[font=Courier New]}[/font]
[font=Courier New]if (endY <= 260){[/font]
[font=Courier New]_root.follower2.gotoAndPlay(“rollout”)[/font]
[font=Courier New]}[/font]
[font=Courier New]}[/font]

The top MC has the same code, except for the values in the conditionals:

[font=Courier New]if (yfinal >= 200){
_root.follower1.gotoAndPlay(“rollover”)
}
if (yfinal <= 230){
_root.follower1.gotoAndPlay(“rollout”)
}
}[/font]

Are these conditionals ok? When I preview the movie, it just doesn’t appear and disappear as it should be…

Can anyone help? I’ll appreciate a lot!!!

Thanks

what’s yfinal - where you defined it?

Forget that last part of code, in fact “yfinal” is incorrect. I’m using the same code of the other MC, the variable is “endY” I want toknow if the conditional is well constructed. Here is the file.

From a quick look at it… I think I know what the problem is.
I mean… I didn’t quite understood what is your final purpose but…

the if condition is just fine… but as long as it is true, with every enterframe it will execute again and again the _root.folower1.gotoandPlay(“rollover”);
so… because is executed each frame… you won’t get to see the animation.

I hope I cleared at least a little bit your problem :).

Thanks Virusescu…

Preciselly that’s what we were figuring out at this time. Any way, I’m triying something else, different codification…

Thanks again…!
:ne: