# Basic AS help needed

**URL:** <https://forum.kirupa.com/t/basic-as-help-needed/231494>\
**Category:** flash\
**Created:** [July 5, 2007, 9:07am UTC](https://forum.kirupa.com/t/basic-as-help-needed/231494 "2007-07-05T09:07:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zhet](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/zhet/32/3307_2.png) [@Zhet](https://forum.kirupa.com/u/Zhet)\
**Post date:** [July 5, 2007, 9:07am UTC](https://forum.kirupa.com/t/basic-as-help-needed/231494/1 "2007-07-05T09:07:33Z")

</div>

i need some basic help with my code

```auto

as = random(4);
		if (as == 0) {
			this._x += 5;
			this._y += 2;
		}
		if (as == 1) {
			this._x -= 5;
			this._y += 2;
		}
		if (as == 2) {
			this._x += 7;
		}
		if (as == 3) {
			this._x -= 7;
		}

```

in any case the object moves once, but i want it to move always until I’ll change the “as” value. Should i use loops or maybe onEnterFrame?
