# Which do you think is better?

**URL:** <https://forum.kirupa.com/t/which-do-you-think-is-better/279569>\
**Category:** flash\
**Created:** [January 16, 2009, 6:21am UTC](https://forum.kirupa.com/t/which-do-you-think-is-better/279569 "2009-01-16T06:21:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![four4swords](https://avatars.discourse-cdn.com/v4/letter/f/87869e/32.png) [@four4swords](https://forum.kirupa.com/u/four4swords)\
**Post date:** [January 16, 2009, 6:21am UTC](https://forum.kirupa.com/t/which-do-you-think-is-better/279569/1 "2009-01-16T06:21:07Z")

</div>

Hey,

I’ve got 2 scripts here… which see if an object is in a particular area…

The first. is the good old fashioned hitTest

```auto

onClipEvent (enterFrame) {
    if (_root.hero.hitTest(this)) {
        _parent.nextFrame();
    }
}

```

And… next I have a checker which checks for the coordinates… and see if the “hero/object” is within it’s area…

```auto

onClipEvent (enterFrame) {
    if (_root.hero._x>_x-60 and _root.hero._x<_x+60 and _root.hero._y>_y-15 and _root.hero._y<_y+15) {
        _parent.nextFrame();
    }
}

```

Which one is better? I heard that hitTests really lag the Flash file/computer down… So it’s better to use calculations… But… Just by looking at the code… I get the impression hitTests are better as it’s clearly more tidier…

Which is better? In terms of speed, in an enviroment where there is many more onEnterFrames occuring.

Thanks
