nardoum The cake is a lie... | Merci c'est gentil ! =D
Maintenant j'arrive pas à l'intégrer
J'ai fait ce code :
Code :
- import java.io.*;
- import javax.microedition.midlet.*;
- import javax.microedition.lcdui.*;
- import javax.microedition.media.*;
- public class HelloWorld extends MIDlet implements CommandListener
- {
- private Display display = null;
- private Form fmMain;
- private Command cmExit;
- private StringItem Msg;
- private Ticker t;
- String eventType = "- Press any!";
- int keyCode;
- public HelloWorld()
- {
- display = Display.getDisplay(this);
- cmExit = new Command("Exit", Command.EXIT, 1);
- fmMain = new Form("Nadim's Rasoir" );
- t = new Ticker("Tu as de la barbe là ! =D " );
- Msg = new StringItem("","" );
- fmMain.addCommand(cmExit);
- fmMain.append(Msg);
- fmMain.setCommandListener(this);
- try
- {
- Image im = Image.createImage((display.isColor()) ? "/supcom_rgb.png" : "/supcom_nb.png" );
- fmMain.append(new ImageItem(null, im, ImageItem.LAYOUT_CENTER, null));
- display.setCurrent(fmMain);
- //
- InputStream is =
- getClass().getResourceAsStream("rasoir1.wav" );
- Player p = Manager.createPlayer(is, "audio/X-wav" );
- p.setLoopCount(10);
- p.start();
-
- //
- }
- catch (java.io.IOException e)
- {
- System.err.println("Unable to locate or read .png file" );
- }
- catch (MediaException e){
- }
- }
- public void startApp()
- {
- fmMain.setTicker(t);
- display.setCurrent(fmMain);
- }
- public void pauseApp()
- {
- }
- public void destroyApp(boolean unconditional)
- {
- }
- public void commandAction(Command c, Displayable s)
- {
- if (c == cmExit)
- {
- destroyApp(false);
- notifyDestroyed();
- }
- }
- }
|
Je veux essayer de faire un keypressed sur l'image pour stopper rasoir1.wav et jouer rasoir2.wav, et que quand je le lache ça fait l'inverse mais j'arrive pas
Et pour la boucle infinie du p.start() je sais pas faire ^^' ---------------
Nardoum
|