# Action Script

**URL:** <https://forum.kirupa.com/t/action-script/6050>\
**Category:** Uncategorized\
**Created:** [September 28, 2002, 7:57am UTC](https://forum.kirupa.com/t/action-script/6050 "2002-09-28T07:57:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![smart\_ritu](https://avatars.discourse-cdn.com/v4/letter/s/b3f665/32.png) [@smart\_ritu](https://forum.kirupa.com/u/smart_ritu)\
**Post date:** [September 28, 2002, 7:57am UTC](https://forum.kirupa.com/t/action-script/6050/1 "2002-09-28T07:57:42Z")

</div>

I am trying to make a game in flash.

I have a ball which has to be moved inside the wall only. I am moving the ball with the keyboard arrows tht works fine. But i dont want the ball to go beyond the wall.How do i do this.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 28, 2002, 9:30am UTC](https://forum.kirupa.com/t/action-script/6050/2 "2002-09-28T09:30:19Z")

</div>

Download the scrolling car game from my site - which has movement based on restriction. If I understand you question it would be something like this:

```php

onClipEvent (load) {
	carSpeed = 14;
}
onClipEvent (enterFrame) {
	if (Key.isDown(Key.RIGHT) && this._x<500) {
		this._x += carSpeed;
	} else if (Key.isDown(Key.LEFT) && this._x>200) {
		this._x -= carSpeed;
	}
}

```

Change the x boundaries to what you want. Add in y boundaries if needed.
