hitTest

Hi, I just worked up an example with scrolling text. The text scrolls up & when you place you mouse over this text clip the text stops scrolling. It works fine but I ran into a question with hitTest. Why does it work backwards. Here’s the code so I may explain

onClipEvent (enterFrame) {
// get the original y position of this
y = _y
// hitTest to determine if the mouse is over this
if (this.hitTest(_root._xmouse,_root._ymouse, false)) {
// do not scroll the clip
this._y = y;

}else{
// set the value of y
y = 1
//subtract y from this._y
this._y -= y
// add 3 to y
y +=3
// if the clip travel outside the mask parameters . . .
if (this._y < 35) {
// put it back within the mask parameters
this._y = 327
}
}
}

On the hitTest part I actually have to set the test to false for the dependant code to be excuted.

Basically what’s up with hitTest working backwards. I’m going to toss the .fla up at members.aol.com/webclicku…ngtext.fla if you need to see exactly what I mean.

Thank you very much.

Make that:
members.aol.com/webclickusa/fla
file is called scrollingtext.fla

Thanks

I don’t understand what you mean? you want it to scroll when the mouse is over? explain a little more…I looked at the FLA and it looked fine to me. but obvoiusly thats not what you are trying to do…That makes sense, but I am now away from my computer and won’t get back til at least 6pm (6hours from now) I can look at it then.

Jubba,
The .fla is working exactly the way I want it to.
However, I don’t under why 1 part is working.
When you mouse over the text is should stop scrolling which it does do. However, the only way the work is if I set the hitTest eval. to false. In other words when you mouse over the text the hitTest should be true & the text should stop scrolling. It works in reverse. Am I making any sense?

Thanks again my friend

[edited: due to massive stupidity]

if (this.hitTest(_root._xmouse,_root._ymouse, false)) {
// do not scroll the clip
this._y = y

this says that when the hitTest is false, the Text does not move, then the else statement says that when the hitTest is true, that the Text does move…thats what I can get from your code.

onClipEvent (enterFrame) {
if (!hitTest(_root._xmouse,_root._ymouse)) {
this._y -= 3
}
if (this._y < 35) {
this._y = 327
}
}

I think this code will do the same thing as your other code, I just made it shorter. By putting the ! in front you are saying that when its false, you want it to move…I didnt’ test it but something like that should work

Jubba,
You are absolutely right, The code says

if (this.hitTest(_root._xmouse,_root._ymouse, false)) {
this._y = y;
The above means like you said if the mouse pointer is NOT placed over the clip the clip should NOT scroll

Below means if the mouse pointer is placed over
the clip the clip should scroll

}else{
// set the value of y
y = 1
//subtract y from this._y
this._y -= y
// add 3 to y
y +=3
// if the clip travel outside the mask parameter . . .
if (this._y < 35) {
// put it back within the mask parameter
this._y = 327
}
}
}
It works completely backwards. Try download the .fla & playing the movie & you’ll see what I mean. Try changing the hitTest false to true & things get really funky. Sorry for being such a donkey. I wrote this little snippit of code myself & got it to work but I can’t say
the if part makes much sense. Sorry to beat a dead horse. I just have to understand this.

Thank you.