# Using keyboard for movement - advanced script? Please help

**URL:** <https://forum.kirupa.com/t/using-keyboard-for-movement-advanced-script-please-help/68106>\
**Category:** Uncategorized\
**Created:** [October 22, 2004, 2:00am UTC](https://forum.kirupa.com/t/using-keyboard-for-movement-advanced-script-please-help/68106 "2004-10-22T02:00:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Agent\_Subterfug](https://avatars.discourse-cdn.com/v4/letter/a/f07891/32.png) [@Agent\_Subterfug](https://forum.kirupa.com/u/Agent_Subterfug)\
**Post date:** [October 22, 2004, 2:00am UTC](https://forum.kirupa.com/t/using-keyboard-for-movement-advanced-script-please-help/68106/1 "2004-10-22T02:00:19Z")

</div>

Hey all,

[http://www.kirupa.com/developer/actionscript/xymove.htm](http://www.kirupa.com/developer/actionscript/xymove.htm)

Kirupa’s tutorial here was something I ran across while trying to learn how to move an MC using the keyboard. However, I’m looking to do a motion that is a bit more complicated than that - and I’m somewhat stumped. (Yup, Im new to actionscripting)

I’d like to be able to move the MC 100 pixels (and that part I’ve figured out), but I need the motion to be smooth - with inertia. I searched and searched, and this is a link I found that looked useful in demonstrating the effect:

[http://experiments.coldstorageonline.com/](http://experiments.coldstorageonline.com/)

Click the 4th example - ‘Inertia, Single plane of movement’

Now, instead of having the \_xmouse determine the position, I want to hit the ‘forward/backward’ keys on the keyboard, and make it hop smoothly forward or backward a 100 pixels. Im just confused where to add what, and I am continuing to work on it.

This is being programmed in Flash MX 2004.

If anyone could offer any help, Id really appreciate it.

Thanks,

Haley
