Skip to main content
Participant
June 18, 2008
Question

hitTest, onMouseMove functions getting in the way of eachother?

  • June 18, 2008
  • 1 reply
  • 275 views
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 -- click 'search projects' and then scroll over client list.


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;
}
}


Amy help appreciated!!!
+ d
This topic has been closed for replies.

1 reply

Participant
June 18, 2008
turns out i did not even need the onMouseMove function, so here is my current code, 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 -- 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.