| View previous topic :: View next topic |
| Author |
Message |
dpeak
Joined: 17 Mar 2009 Posts: 1
|
Posted: Tue Mar 17, 2009 12:59 pm Post subject: Accessing GameDesign in Midlet Flow |
|
|
Hello,
I am new with JavaME in Netbeans. I want to create a game for my mobile but got stuck when it came to switching from the menu to the game itself.
The menu is a midlet called MyMidlet and the GameDesign is a seperate class:
Can anybody tell me how to program a command to run the game in the GameDesign class?
I heard that it is possible to add a whole class to the Pallete to add it from there to the Flow but I couldn't figure out how.
Please help. |
|
| Back to top |
|
 |
kherink
Joined: 19 Mar 2009 Posts: 1 Location: sydney, aus
|
Posted: Thu Mar 19, 2009 11:32 am Post subject: source code solution |
|
|
I would create a List in the flow, then add a List Element to it (call it "Start game") then in the Source view i would modify the listAction() method to look something like this:
| Code: | //<editor-fold defaultstate="collapsed" desc=" Generated Method: listAction ">
/**
* Performs an action assigned to the selected list element in the list component.
*/
public void listAction() {
// enter pre-action user code here
String __selectedString = getList().getString(getList().getSelectedIndex());
if (__selectedString != null) {
if (__selectedString.equals("Start game")) {
// write pre-action user code here
// write post-action user code here
this.gameCanvas = new DemoGameCanvas();
this.t = new Thread(gameCanvas);
t.start();
Display d = getDisplay();
d.setCurrent(gameCanvas);
}
}
// enter post-action user code here
}
//</editor-fold> |
this will not show up as anything meaningful in the flow view but should do the trick of starting up the game design |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|
|
|