i have an AI script that is supposed to run when i click a button but it works only when i click the button and when i let go clicking it the AI script stops. how do i get around this?
heres wut i have
this.onRelease = function () {
if(_root.man._x > this._x) {
this.play();
this._x += speed;
} if(_root.man._x < this._x) {
this.play();
this._x -= speed;
} if(_root.man._y > this._y) {
this.play();
this._y += speed;
} if(_root.man._y < this._y) {
this.play();
this._y -= speed;
}
if (this.hitTest(_root.man)) {
speed = 0;
this.stop();
}else { if (this.hitTest(_root.man)== false) {
speed = 4;
this.play();
}
}
}
i want the script to keep running even after i click the button