all groups > flash actionscript > april 2007 >
You're in the

flash actionscript

group:

hitTest issue


hitTest issue chrissy b
4/9/2007 7:05:37 PM
flash actionscript:
i am trying to correct an issue with the hitTest method used in one of my
projects. i have a scrolling mc that contains several mc's, and when the user
clicks on an area of the main mc, an event occurs elsewhere in my movie. it is
working for the most part, however in a couple of instances...when the mc is
scrolling down...one of the mc's does not work...when it is hit the event does
not occur. the code is below...any help is appreciated...



linkSet_mc.onMouseDown = function() {
if (this.test1.hitTest(_root._xmouse, _root._ymouse, true)) {
trace("test1 was pressed!");
//myMovie.getApp().postEvent("onSubSubNavigate", { yTextEnd: -120, ySubEnd:
113, activeSubTab: 0 });
}
else if (this.test2.hitTest(_root._xmouse, _root._ymouse, true)) {
trace("test2 was pressed!");
//myMovie.getApp().postEvent("onSubSubNavigate", { yTextEnd: -320, ySubEnd:
-27, activeSubTab: 0 });
}
else if (this.test3.hitTest(_root._xmouse, _root._ymouse, true)) {
trace("test3 was pressed!");
//myMovie.getApp().postEvent("onSubSubNavigate", { yTextEnd: -520, ySubEnd:
-165, activeSubTab: 0 });
}
else if (this.test4.hitTest(_root._xmouse, _root._ymouse, true)) {
trace("test4 was pressed!");
//myMovie.getApp().postEvent("onSubSubNavigate", { yTextEnd: -720, ySubEnd:
-305, activeSubTab: 0 });
}
else if (this.test5.hitTest(_root._xmouse, _root._ymouse, true)) {
trace("test5 was pressed!");
//myMovie.getApp().postEvent("onSubSubNavigate", { yTextEnd: -920, ySubEnd:
-445, activeSubTab: 0 });
}


}
Re: hitTest issue kglad
4/9/2007 7:34:09 PM
none of those movieclips overlap, correct? if none overlap, which one's not
working?

click on that movieclip in the authoring environment and check its instance
name. you probably have failed to enter its instance name or have a typo.

if any of them overlap, and you want all the hitTest() to execute, don't use
else if conditionals.
Re: hitTest issue chrissy b
4/9/2007 7:42:54 PM
....it is test2 that is not working..i have double checked the instance
name...they don't overlap but rather i have added on three duplicate instances
at the bottom because i want the scrolling to be continuous with no
gaps...does that make sense? when i remove the three extra instances, it does
work...however there is this ugly gap which will confuse the user.
Re: hitTest issue kglad
4/9/2007 8:01:02 PM
Re: hitTest issue chrissy b
4/9/2007 8:04:05 PM
Re: hitTest issue kglad
4/9/2007 9:36:55 PM
AddThis Social Bookmark Button