PDA

View Full Version : hitTest won't work, please help soon!


indwellingfire
09-26-2006, 05:03 PM
I'm trying to set up a drop down menu that has a limited hitArea for the sub-menu options. I need the sub-menu options to go away (and an animation to reset) after the user rolls out of the hit Area. I've got the hitArea set up, but it won't reset properly upon rollOut/leaving hitArea. It only goes away if you roll back ON to the menu option from the TOP of the menu. I thought I knew what the problem might be, but now i'm not sure. I've looked at many similar examples, but none of them solve the problem with code, it's always an animation workaround (typically involving invisible buttons). That's why I came here! Please help, anyone!

see attached .fla for more details. (roll over "design", the hit area will pop up as a rectangle to aid with the problem illustration, roll back over "design from the top of it to reset the sliding menu, otherwise it won't reset).

Thanks.

p.s. if you don't feel like dLing the example, here's my code:

function revealDesign(){
design_btn.onRollOver = function(){
//slides menu boxes over to new location
new Tween (boxone, "_x", mx.transitions.easing.Strong.easeOut, 23, 331, 33, false);
new Tween (boxtwo, "_x", mx.transitions.easing.Strong.easeOut, 177, 485, 25, false);
new Tween (boxthree, "_x", mx.transitions.easing.Strong.easeOut, 330, 636, 20, false);
new Tween (boxfour, "_x", mx.transitions.easing.Strong.easeOut, 484, 815, 15, false);
new Tween (boxfive, "_x", mx.transitions.easing.Strong.easeOut, 636, 888, 15, false);
//sub-menu options are brought out
setDesign();
//make sure other sub-menus aren't visible
resetProperties();
//create hit area w/Drawing API
createEmptyMovieClip("designMenuBox_mc", 0)
with (designMenuBox_mc) {
beginFill (0xFFFFFF, 20);
moveTo(23, 20);
lineTo(325, 20);
lineTo(325, 190);
lineTo(23, 190);
endFill();
}
//perform hitTest to track user's mouse movement
if
(designMenuBox_mc.hitTest(_xmouse, _ymouse) != true) {
//everything after resets the menu to it's previous state.
unloadDesignBox();
new Tween (boxone, "_x", mx.transitions.easing.Strong.easeOut, 331, 23, 33, false);
new Tween (boxtwo, "_x", mx.transitions.easing.Strong.easeOut, 485, 177, 25, false);
new Tween (boxthree, "_x", mx.transitions.easing.Strong.easeOut, 636, 330, 20, false);
new Tween (boxfour, "_x", mx.transitions.easing.Strong.easeOut, 815, 484, 15, false);
new Tween (boxfive, "_x", mx.transitions.easing.Strong.easeOut, 888, 636, 15, false);
resetDesign();
}
}
}