Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Revision as of 03:29, 14 September 2009 by rahulvala (Talk | contribs)

Archived:How to make a basic key movement in Flash Lite

From Wiki
Jump to: navigation, search

Flash Lite 1.1

Flash Cartesian Coordinate

First know that Flash Cartesian coordinate with four separate coordinate for each side. Basically Cartesian coordinate likes a flash root timeline. It will always start in the upper left hand corner on the root timeline. The top left corner in flash the X,Y coordinates is (0,0).

Flash coordinates represent position of WIDTH along the x axis and HEIGHT along the y axis

Flash coordinate represent positions of width along the X axis and Height along the Y axis.

Create a movie clip.

Draw 16X16 rectangle and make center align.

Make a Instance Name "Player".

Add key listener

on(KeyPress "<Left>"){
// Define _x axis movement.
/*The _x coordinate of a movie clip, relative to the local coordinates of the parent movie clip. Its coordinate system refers to the upper-left corner of the stage as (0,0).*/
//The width of the movie clip in pixels.
if(player. _x>(player._width/2)){
player. _x - =5;
on(keyPress "<Down>"){
player._x +=5;
on(keyPress "<Up>"){
// Define _y axis movement.
player._y -=5;
on(keyPress "<Down>"){
player._y +=5;


you can download an example with source code here:

Basic key Movement

Narender Raul

59 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.


Thank you!

We appreciate your feedback.