Basic AS help needed

i need some basic help with my code


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?