×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Aug 2003
    Posts
    8

    Nokia 6600 - backlight

    Hi,

    Because the vibrator can't be controlled on the 6600, I started to create a visual effect with the backlight.
    Here is the code that makes this effect :

    import javax.microedition.lcdui.*;
    import com.nokia.mid.ui.*;

    public class Flash
    implements Runnable
    {
    private Display display;

    public Flash(Display display)
    {
    this.display = display;
    }

    public synchronized void run()
    {
    int count = 0;

    try
    {
    do
    {
    display.flashBacklight(250);

    wait(250);

    display.flashBacklight(0);

    wait(250);
    }
    while (count++ < 4);

    DeviceControl.setLights(0, 100); //does nothing
    }
    catch (InterruptedException ie)
    {

    }
    }
    }

    Is there a best way to do that kind of effect ?
    And most importantly when the loop ends, the backlight of the phone is turned off.
    Is it possible to turn it on ? I tried and use the DeviceControl class without success.

    Nokia 6600 firmware: v3.42.1 16-10-03 NHL-10

    Here is the MIDlet that I use to test the effect

    import javax.microedition.lcdui.*;
    import javax.microedition.midlet.*;

    public class FlashMIDlet
    extends MIDlet
    implements CommandListener
    {
    private Form form = new Form("Flash");

    private Command exit = new Command("Exit", Command.EXIT, 1);

    private Command flash = new Command("Flash", Command.SCREEN, 1);

    public void startApp()
    {
    form.addCommand(exit);
    form.addCommand(flash);

    form.setCommandListener(this);

    Display.getDisplay(this).setCurrent(form);
    }

    public void pauseApp()
    {

    }

    public void destroyApp(boolean param)
    {

    }

    public void commandAction(Command command, Displayable displayable)
    {
    if (command == exit)
    {
    destroyApp(true);

    notifyDestroyed();
    }
    else if (command == flash)
    {
    new Thread(new Flash(Display.getDisplay(this))).start();
    }
    }
    }

  2. #2
    Regular Contributor
    Join Date
    Mar 2003
    Location
    USA, FL
    Posts
    148
    IMHO, it is not the best way to do flashing.
    If you want to make your screen darker, you may use 2 approaches:
    1) Nokia API's DirectGraphics. Use the transparency. This method is very nice one but only if you orient only on Nokia phones.
    2) Use dark textures. This method will work everywhere but requres twice more memory... If your game is not a big one - use this method.

    Dima.

  3. #3
    Registered User
    Join Date
    Aug 2003
    Posts
    8
    Hi Dima,

    You're right, we could use the Nokia's API. Unfortunately I forgot to mention that our application is not a game and uses Screen objects instead of Canvas.
    If only this damned vibrator could be controlled ... :-(

    Olivier.

  4. #4
    Registered User
    Join Date
    Jul 2004
    Posts
    7
    Get FExplorer from http://www.gosymbian.com/ and use the Tools menu option it has to turn the light on (and leave the program running when you switch to other apps, instead of closing it).

Posting Permissions

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