EXPLAINING:~1~: this is the key that you press to make the character make. Ex: spacebar, 2 key, G key, etc.~2~: this is the axis that the object will move on. Y axis is horizontal and X axis is vertical.~3~: this is the speed that it moves when you press a button. Pretty self-explanatory.

onClipEvent (load) {\r\n moveSpeed = ~3~;\r\n}\r\nonClipEvent (enterFrame) {\r\n if (Key.isDown(Key.~1~)) {\r\n this._~2~+=moveSpeed;\r\n }\r\n}\r\n\r\n\r\n\r\nEXPLAINING:\r\n~1~: this is the key that you press to make the character make. Ex: spacebar, 2 key, G key, etc.\r\n~2~: this is the axis that the object will move on. Y axis is horizontal and X axis is vertical.\r\n~3~: this is the speed that it moves when you press a button. Pretty self-explanatory.\r\n\r\n\r\n\r\nSo, in the end, it would look something like this:\r\n\r\n\r\n\r\nonClipEvent (load) {\r\n moveSpeed = 15;\r\n}\r\nonClipEvent (enterFrame) {\r\n if (Key.isDown(Key.RIGHT)) {\r\n this._x+=moveSpeed;\r\n }\r\n if (Key.isDown(Key.LEFT)) {\r\n this._x-=moveSpeed;\r\n }\r\n if (Key.isDown(Key.DOWN)) {\r\n this._y+=moveSpeed;\r\n }\r\n if (Key.isDown(Key.UP)) {\r\n this._y-=moveSpeed;\r\n }\r\n}

note that your movement function is also an argument of the event listener. The character name is whatever you want to move when the key is depressed.

is that not AS2 code?\r\n\r\nin Actionscript 3 all key inputs are dealt with event handlers.\r\n\r\nTo use these you need two things, a function to execute when the event occurs and an event listener on the stage to listen for keyboard input.\r\n\r\nIt looks like...\r\n\r\nfunction <function name> (event:KeyboardEvent){\r\n if(event.keyCode == Keyboard.LEFT){\r\n <character name>.x -= <movement speed>\r\n }\r\n}\r\n\r\nstage.addEventListener(KeyboardEvent.KEY_DOWN, <function name>);\r\n\r\nnote that your movement function is also an argument of the event listener. The character name is whatever you want to move when the key is depressed.

Flip a Coin...

Play free online games at Armor Games!

We strive to deliver the best online games experience on the internet, with thousands of free online games for kids, access to free mmorpg games, free online games for girls, online rpg games, fun online flash games, and more. We offer free flash games in many different genres: online shooting games, online puzzle games, online war games, free online car games, free online hidden object games and dozens more. This is the best place on the web to play online games for free... play on Armor Games! No matter what game style you prefer, we've got it here.

As one of the biggest free gaming websites, we offer thousands of new game reviews and ratings, making it easy for gamers to find new games every day. We offer only the best games from developers Jmtb02, Krin, ConArtist, Joey Betz, Tony Lavell, Louissi, Gameinabottle and of course Armor Games develops some of the best games around.

About Armor Games (ArmorGames.com, Armour Games, or Armored Games)

We are dedicated to providing our players the best online gaming experience on the internet! Visit every day to discover new games, achieve high scores, and participate in one of the most active gaming communities.

Submit a Game

Have your game played by millions of gamers! Armor Games welcomes game submissions from talented game developers. Not every game makes the cut, but if it does, we'll promote it on Armor Games and give you all the credit and link back to your site. Submit your game here and good luck!