# hitTest for scroller onMouseMove not working!

**URL:** <https://forum.kirupa.com/t/hittest-for-scroller-onmousemove-not-working/263674>\
**Category:** Uncategorized\
**Created:** [June 18, 2008, 8:29am UTC](https://forum.kirupa.com/t/hittest-for-scroller-onmousemove-not-working/263674 "2008-06-18T08:29:48Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![sparrowco](https://avatars.discourse-cdn.com/v4/letter/s/5f9b8f/32.png) [@sparrowco](https://forum.kirupa.com/u/sparrowco)\
**Post date:** [June 18, 2008, 8:29am UTC](https://forum.kirupa.com/t/hittest-for-scroller-onmousemove-not-working/263674/1 "2008-06-18T08:29:48Z")

</div>

why doesnt this work!!!

projectSearch.clientListMask.onMouseMove = function() {  
if (this.hitTest(\_root.\_xmouse, \_root.\_ymouse, false)) {  
clientListScroll = Math.max(0, Math.min(this.\_ymouse-20, 175)) / 175;  
calClientListPosition();  
} else {  
projectSearch.clientLinksHolder.ypos = 40;  
}  
}

ypos triggers some script that it supposed to tween the mc back to its start position when rolling out of the hit area. all parts work on their own but when i put them together it gets funky.

view the link at [http://www.blog.en-vuela.com/projects](http://www.blog.en-vuela.com/projects) – click ‘search projects’ and then scroll over client list.

any help is much appreciated!!!

- d

---

<div class="post-metadata">

**Author:** ![sparrowco](https://avatars.discourse-cdn.com/v4/letter/s/5f9b8f/32.png) [@sparrowco](https://forum.kirupa.com/u/sparrowco)\
**Post date:** [June 18, 2008, 8:32am UTC](https://forum.kirupa.com/t/hittest-for-scroller-onmousemove-not-working/263674/2 "2008-06-18T08:32:57Z")

</div>

i also tried:

projectSearch.clientListMask.onMouseMove = function() {  
if (this.hitTest(\_root.\_xmouse, \_root.\_ymouse, false)) {  
clientListScroll = Math.max(0, Math.min(this.\_ymouse-20, 175)) / 175;  
calClientListPosition();  
} else if (!(this.hitTest(\_root.\_xmouse, \_root.\_ymouse, false))) {  
projectSearch.clientLinksHolder.ypos = 40;  
}  
}

- d

---

<div class="post-metadata">

**Author:** ![sparrowco](https://avatars.discourse-cdn.com/v4/letter/s/5f9b8f/32.png) [@sparrowco](https://forum.kirupa.com/u/sparrowco)\
**Post date:** [June 18, 2008, 10:09am UTC](https://forum.kirupa.com/t/hittest-for-scroller-onmousemove-not-working/263674/3 "2008-06-18T10:09:40Z")

</div>

turns out i did not even need the onMouseMove function, so here is my full current code for the scrolling function, and it works! - not quite as smooth as i want it to be yet though.

and the link: [http://www.blog.en-vuela.com/projects](http://www.blog.en-vuela.com/projects) – cick on ‘search projects’ at the bottom and then scroll over the client list.

var clientListScroll = 0;

function calClientListPosition(){  
projectSearch.clientLinksHolder.\_y = Math.round(projectSearch.clientListMask.\_y - Math.max(0, lastClientLink.\_y + linkBtnHeight - projectSearch.clientListMask.\_height) \* clientListScroll);  
}

projectSearch.clientListMask.onEnterFrame = function() {  
if (this.hitTest(\_root.\_xmouse, \_root.\_ymouse, false)) {  
clientListScroll = Math.max(0, Math.min(this.\_ymouse-20, 175)) / 175;  
calClientListPosition();  
} else if (!(this.hitTest(\_root.\_xmouse, \_root.\_ymouse, false))) {  
trace (“mouseIsNotOVer”);  
projectSearch.clientLinksHolder.ypos = 40;  
}  
}

\*\*\*\* any tips on getting it to be a smoother scroll would be killer.

---

<div class="post-metadata">

**Author:** ![sparrowco](https://avatars.discourse-cdn.com/v4/letter/s/5f9b8f/32.png) [@sparrowco](https://forum.kirupa.com/u/sparrowco)\
**Post date:** [June 18, 2008, 12:10pm UTC](https://forum.kirupa.com/t/hittest-for-scroller-onmousemove-not-working/263674/4 "2008-06-18T12:10:47Z")

</div>

Here is the latest, better and better bit by bit!

// on the mc i want to scroll (projectSearch.clientLinksHolder)

onClipEvent (load) {  
yspeed = 10;  
}

onClipEvent (enterFrame) {  
current\_y = this.\_y;  
dif\_y = current\_y-ypos;  
this.\_y = current\_y-(dif\_y/yspeed);  
}

// on root actions layer:

var clientListScroll = 0;

function calClientListPosition(){  
newY = Math.round(projectSearch.clientListMask.\_y - Math.max(0, lastClientLink.\_y + linkBtnHeight - projectSearch.clientListMask.\_height) \* clientListScroll);  
projectSearch.clientLinksHolder.ypos = newY;  
}

projectSearch.clientListMask.onEnterFrame = function() {  
if (this.hitTest(\_root.\_xmouse, \_root.\_ymouse, false)) {  
clientListScroll = Math.max(0, Math.min(this.\_ymouse-20, 175)) / 175;  
calClientListPosition();  
} else if (!(this.hitTest(\_root.\_xmouse, \_root.\_ymouse, false))) {  
//trace (“mouseIsNotOVer”);  
projectSearch.clientLinksHolder.ypos = 40;  
}  
}

any way it could be better?  
(i would prefer for it to wait to start scrolling until the mouse moves up or down the list rather than right away.)

- d

here’s the link: [http://www.blog.en-vuela.com/projects](http://www.blog.en-vuela.com/projects) – click on ‘search projects’ at the bottom and then scroll through client list.

---

<div class="post-metadata">

**Author:** ![randomagain](https://avatars.discourse-cdn.com/v4/letter/r/35a633/32.png) [@randomagain](https://forum.kirupa.com/u/randomagain)\
**Post date:** [June 18, 2008, 12:18pm UTC](https://forum.kirupa.com/t/hittest-for-scroller-onmousemove-not-working/263674/5 "2008-06-18T12:18:31Z")

</div>

erm a swf to see what is going on would help

can’t seem to load your website

---

<div class="post-metadata">

**Author:** ![sparrowco](https://avatars.discourse-cdn.com/v4/letter/s/5f9b8f/32.png) [@sparrowco](https://forum.kirupa.com/u/sparrowco)\
**Post date:** [June 18, 2008, 4:18pm UTC](https://forum.kirupa.com/t/hittest-for-scroller-onmousemove-not-working/263674/6 "2008-06-18T16:18:50Z")

</div>

[quote=randomagain;2344876]erm a swf to see what is going on would help

can’t seem to load your website[/quote]

can you see the flash content on either of these pages?:  
[http://www.blog.en-vuela.com/home](http://www.blog.en-vuela.com/home)  
[http://www.blog.en-vuela.com/projects](http://www.blog.en-vuela.com/projects)

what browser / platform are you using?
