Categories: How To | Flash Lite | Code Examples | UI | Usability
This page was last modified 01:08, 19 February 2008.
How to make a basic key movement in Flashlite
From Forum Nokia Wiki
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 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>"){ if(player._x<(172-(player._width/2))){ player._x +=5; } } on(keyPress "<Up>"){ // Define _y axis movement. if(player._y>(3+(player._width/2))){ player._y -=5; } } on(keyPress "<Down>"){ if(player._y<(203-(player._width/2))){ player._y +=5; } }
Download
you can download an example with source code here:
Narender Raul
| Related Discussions | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| 3300 key's not detected | SiegGuile | Mobile Java General | 2 | 2005-01-04 21:46 |
| CEikRichTextEditor....SetCursorPosL | VinodRaut | Symbian User Interface | 6 | 2007-09-12 06:56 |
| DBMS Question... | danieLs0xff | General Symbian C++ | 6 | 2006-02-21 16:18 |
| Yucca please help: Long key press - iRepeats is never 1 | Tasneem Rangwala | General Symbian C++ | 0 | 2008-04-06 13:01 |
| how to use the left key over the joystick? | sblider | General Symbian C++ | 3 | 1970-01-01 02:00 |
