Hi guys

i'm using a motion dection system to control an interface and instead of doing each hit test on it's own i wanted a function which would make it simplier to code... instead of righting a million and 1 if statements..

Well this isn't producing any errors but i'm sure it's wrong because it's not working...so i'm just checking in with you guys to see if i'm writing my hit tests and variables right... the hover function needs to relate to what ever i call it in the paramaters when i call the function... anyhelp would be most grateful..

Andy


Code:
 

//HIT-TESTFUNCTIONS

function hitAndHover(target,hover):Void{
		var hover:Number=0;
	if (trackdot.hitTest(target)){
		hover++;
		target.gotoAndPlay("OverState");
		trace(hover);
		
	}else{
		target.gotoAndPlay("NormalState")
		hover=0;
	}
};

//Activation Function

function Thumbs_hitAndPlay(target,sName,sPos):Void{
	if (hover==20) {
		_root.populateCONTENT(sName,sPos);
		target.gotoAndPlay("Selected");
		trace("Activated");
		hover=0;
	}

};

//CALLING THE FUNCTIONS.. THESE ARE ON THE TIME LINE WHERE THEY ARE MEANT TO ACTIVATE IN THIS CASE INSPIRE.. 

//THUMB1
//Here i'm trying to tell it to in laymans terms.. if trackdot (which is the movie clip which is moved via motion detection) hits thumb1 start counting hover1

_root.hitAndHover(thumb1_mc,hover1);

//Here i'm trying to tell it to in laymans terms again to if trackdot has hit thumb1 for hover1 count 20 then activate function populateContent with the 
Inspire array at 0.

_root.Thumbs_hitAndPlay(hover1,thumb1_mc,"Inspire",0);

//THUMB2

_root.hitAndHover(thumb2_mc,hover2);
_root.Thumbs_hitAndPlay(hover2,thumb2_mc,"Inspire",1);

//THUMB3

_root.hitAndHover(thumb3_mc,hover3);
_root.Thumbs_hitAndPlay(hover3,thumb3_mc,"Inspire",2);

//THUMB4

_root.hitAndHover(thumb4_mc,hover4);
_root.Thumbs_hitAndPlay(hover4,thumb4_mc,"Inspire",3);

//THUMB5

_root.hitAndHover(thumb5_mc,hover5);
_root.Thumbs_hitAndPlay(hover5,thumb5_mc,"Inspire",4);

//THUMB6
_root.hitAndHover(thumb6_mc,hover6);
_root.Thumbs_hitAndPlay(hover6,thumb6_mc,"Inspire",5);