Flash game moving controls
In this Flash actionscript tutorial you will see the basics of how to assign keyboard key values to move an object around, a very useful effect for games and other interactive flash projects.
First of we will draw or import an object to move around, I just imported mine as shown below.
Now right click your new object and convert it to a movie clip, in the properties panel give our new movie clip an instance name, I called mine move_obj.
Select your movie clip and hit F9 to get to the action script panel and type in the following code and I will explain below.
First we have an event handler called onClipEvent (enterframe) wrapped around our code, this event handler tells flash to "update" or repeat/check the code repeatly.
Then we have the same functionallity for 4 different keys, the up, down, left and right. An if statement telling flash, if one of those buttons is down, move the selected object from its position and add or subtract 15 px.
Its as simple as that.