# {Help} I Misunderstand this code

**URL:** <https://forum.kirupa.com/t/help-i-misunderstand-this-code/75500>\
**Category:** flash\
**Created:** [January 9, 2005, 7:18pm UTC](https://forum.kirupa.com/t/help-i-misunderstand-this-code/75500 "2005-01-09T19:18:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![BullDog\_Flash](https://avatars.discourse-cdn.com/v4/letter/b/d07c76/32.png) [@BullDog\_Flash](https://forum.kirupa.com/u/BullDog_Flash)\
**Post date:** [January 9, 2005, 7:18pm UTC](https://forum.kirupa.com/t/help-i-misunderstand-this-code/75500/1 "2005-01-09T19:18:10Z")

</div>

Alright, How’s Everything going on in flashkit. I hope it’s going good?.

Well I have a problem with my code and dont Understand it fully.

Alright the code.

```auto
onClipEvent (load) {
    b = this.getBounds(this);
}
onClipEvent (enterFrame) {
    if (Key.isDown(39)) {
        _x += 4;
    }
    if (Key.isDown(37)) {
        _x -= 4;
    }
    if (Key.isDown(38)) {
        _y -= 4;
    }
    if (Key.isDown(40)) {
        _y += 4;
    }
    if (!_root.hit.hitTest(_x+x+b.xmin+1, _y+y+b.ymin+1, true)) {
        if (!_root.hit.hitTest(_x+x+b.xmax+1, _y+y+b.ymin+1, true)) {
            if (!_root.hit.hitTest(_x+x+b.xmin+1, _y+y+b.ymax+1, true)) {
                if (!_root.hit.hitTest(_x+x+b.xmax+1, _y+y+b.ymax+1, true)) {
                    _x += x;
                    _y += y;
                }
            }
        }
    }
}

```

That’s the code. Now I was searching through goggle. And flashkit for Shape flag hitTest, and all edge’s hitest. And I found Edmacks Edblog site

Well I saw that the code was used with a function, and since My movement code is not in a function and I don’t want to change it into a function, I decided to try it myself and use the code without using a function that’s the code I came up with.

I think I understand some of the code but not enough to make it work the right way.

I attached the Fla.

Anyways the hitTest don’t work but there isn’t no errors. So im guessing it’s because I don’t understand the code and I did something wrong

- Bulldog\_Flash
