I did not write this code, but i cannot find where it’s wrong, so it
doesn not work. It’s just supposed to move a box randomly along
the x axis. Any thoughts?
onClipEvent (load) {
var limit = 600;
var rand = random(limit);
var currentPos = this._x;
var speed = 5;
}
onClipEvent (enterFrame) {
if (rand<=currentPos) {
var count = rand;
while (count>currentPos) {
this._x -= speed;
var count = count-speed;
//var currentPos = this._x;
}
} else {
var count = rand;
while (count<currentPos) {
this._x += speed;
var count = count+speed;
//var currentPos = this._x;
}
}
}