Flash
   
 
Moving a clip using keyboard

 

Example:

Press Up, Down, Right, Left

Step1:

Draw a square

 

 

Step2:

convert to Symbol

select Movie clip

Step3:

press the square and f9

type the Script below

onClipEvent (load) {
moveSpeed = 19;
}
onClipEvent (enterFrame) {
if (Key.isDown (Key.RIGHT)) {
this._x += moveSpeed;
} else if (Key.isDown (Key.UP)) {
this._y -= moveSpeed;
} else if (Key.isDown (Key.DOWN)) {
this._y += moveSpeed;
} else if (Key.isDown (Key.LEFT)) {
this._x -= moveSpeed;
}
}

Copyright © 2006 FP