# Side-Scrolling Background w/ HitTest

**URL:** <https://forum.kirupa.com/t/side-scrolling-background-w-hittest/308253>\
**Category:** flash\
**Created:** [April 20, 2010, 8:23am UTC](https://forum.kirupa.com/t/side-scrolling-background-w-hittest/308253 "2010-04-20T08:23:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jephz](https://avatars.discourse-cdn.com/v4/letter/j/58956e/32.png) [@Jephz](https://forum.kirupa.com/u/Jephz)\
**Post date:** [April 20, 2010, 8:23am UTC](https://forum.kirupa.com/t/side-scrolling-background-w-hittest/308253/1 "2010-04-20T08:23:09Z")

</div>

I know this may sound very noobish, but how do you code a working scrolling background w/ hitTest functions?

I’ve coded a scrolling background b4 no problem, but when “player” hitTest a impassable terrain/block, I want the background to stop scrolling along with the player to stop moving.

Now, i thought it was somewhat around these lines:

```auto

if(_root.player.hiTest(hitMC._x , hitMC._y ,true)) {
_root.isBlocked = true
} else {
_root.isBlocked = false
}

```

but apparently, it doesn’t work because when the player HitTest “block”, var isBlock just changes back and forth from “true” to “false” very fast.

Is there a solution to this?

-Jephz
