Linear movement
Code Actionscript 2.0
Instance action
onClipEvent (enterFrame) {
this._x = this._x + 2;
this._y = this._y + 1;
}
Code Actionscript 3.0
addEventListener(Event.ENTER_FRAME, enterFrame); function enterFrame(event:Event) { square.x = square.x + 2; square.y = square.y + 1; }
Description
With this script, the x and y coordinates of the object are increased. This causes the object to move continuously in one defined direction.
Download
Right click: Flashfile AS 2.0 | Flashfile AS 3.0 | SWF-File