# Hittest with mousedown problem

**URL:** <https://forum.kirupa.com/t/hittest-with-mousedown-problem/233092>\
**Category:** Uncategorized\
**Created:** [July 20, 2007, 1:10am UTC](https://forum.kirupa.com/t/hittest-with-mousedown-problem/233092 "2007-07-20T01:10:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![limeflex](https://avatars.discourse-cdn.com/v4/letter/l/53a042/32.png) [@limeflex](https://forum.kirupa.com/u/limeflex)\
**Post date:** [July 20, 2007, 1:10am UTC](https://forum.kirupa.com/t/hittest-with-mousedown-problem/233092/1 "2007-07-20T01:10:25Z")

</div>

Slight problem, I have a flash game in which i have a target following my mouse cursor and when i hit an object the score rises all working ok.

But when i hit the target then move my mouse cursor off the target Score Stops (which is fine) But while still with my mouse clicked i move back onto the target score needs to continue to rise and with my code below it stops.

The target \*\*cog\_mc.hitTarget\_mc \*\*needs to detect the mouse has been pressed and when you rollover with mouse still pressed score needs to rise.

Do i need some type of listener or Loop?

my code for this part is below, thanx!

cog\_mc.hitTarget\_mc.[COLOR=#000087]onMouseDown[/COLOR] = [COLOR=#000087]function/COLOR{

```
    [COLOR=#000087]if[/COLOR] ([COLOR=#000087]this[/COLOR].[COLOR=#000087]hitTest[/COLOR]([COLOR=#000087]_root[/COLOR].[COLOR=#000087]_xmouse[/COLOR],[COLOR=#000087]_root[/COLOR].[COLOR=#000087]_ymouse[/COLOR],[COLOR=#000087]true[/COLOR])){

            gameScore(); [COLOR=#878787]//function adds points to score[/COLOR][COLOR=#878787]

```

[/COLOR]  
}  
}  
[COLOR=#878787]//  
[/COLOR]cog\_mc.hitTarget\_mc.[COLOR=#000087]onMouseUp[/COLOR] = [COLOR=#000087]function/COLOR{

```
    [COLOR=#000087]clearInterval[/COLOR](scorerInt); [COLOR=#878787]//function stops adding points to score[/COLOR]  

```

}
