You Are Here:

Community: Developer Discussion Boards

#1 Old RE: Key event not working in 7650 simulator - 1970-01-01, 02:00

Join Date: Mar 2003
Posts: 1
hillcast1
Offline
Registered User
Dunno 'bout the 7650, but the 7210 does not seem to recognize the arrow keys as being mapped to Canvas.UP, DOWN, etc. Turns out the Canvas.UP is the '2' phone pad key. The Canvas.DOWN is the '8' phone pad key.

However, if you read the explicit key values instead of Canvas.UP, etc, you can actually trap the up, down, left, right arrow keys as follows, at least on the 7210 this is true:
up = -1
down = -2
left = -3
right = -4
Reply With Quote

#2 Old Key event not working in 7650 simulator - 2002-12-15, 15:47

Join Date: Mar 2003
Posts: 47
shahzad73
Offline
Registered User
hello there

i program and test a game which i develop in J2ME and test it on Erisson P800 simulator.... there is character on screen whcih can be controlled by arrow keys. i fully design and test the game on P800 simulator.. then i re compile the program using SUN ONE Studio for mobile and test it on 7650 simulator.... it seems to me that the key event is not being generated in the Canvas onject... here are some parts of the code....






package Dragon;

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import java.util.*;
import java.io.*;
import javax.microedition.io.*;

public class SSCanvas extends Canvas
{
public boolean sleep;

boolean leftKey, rightKey, upKey, downKey;


protected void keyPressed(int keyCode)
{
// Get the game action from the key code
int action = getGameAction(keyCode);

if(action == LEFT)
leftKey = true;
else if(action == RIGHT)
rightKey = true;
else if(action == UP)
upKey = true;
else if(keyCode == DOWN)
downKey = true;

}



protected void keyReleased(int keyCode)
{
// Get the game action from the key code
int action = getGameAction(keyCode);

if(action == LEFT)
leftKey = false;
else if(action == RIGHT)
rightKey = false;
else if(action == UP)
upKey = false;
else if(action == DOWN)
downKey = false;

}




}



as can be seen that on the key press event i set a variable to true. then on key release it is turn to false. in this way untill the key is pressed then the character continue to moves in that direction.



ITS WORKING ON P800 Simulator why NOT 7650.


Shahzad
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Forum Jump

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia