Ludicrous Software

Quirks With the Device Object

With FL 3.1, Nokia added the Device object to S60 Platform Services (see Dale’s rundown). The best part of the Device object is that it enables FL developers to disable the auto-rotation that plagued FL 3.0 on S60 5th Edition devices. Although there’s probably still some need to have a fallback in case the end-user hasn’t updated to FL 3.1, it seems like Nokia’s doing a good job of making users aware of the update, so hopefully most people will install the update.

I’ve discovered some quirks with the Device object that are worth keeping in mind when using the Device class:

  1. Things seem to work best if you set `Stage.scaleMode` to `”noScale”` and `Stage.align` to `”TL”`. Otherwise you get funky scaling/positioning issues.
  2. However, once you do that, then `Stage.height` and `Stage.width` will vary depending on the orientation of the phone when the user starts your application. If the phone’s in portrait mode, then the stage is 360 wide by 640 high, but if it’s in landscape mode, the stage is 640 wide by 360 high. If you’re working on landscape content and the stage size of your FLA file is 640 wide by 360 high, then after you’ve disabled auto-rotation, you need to check to see whether you need to rotate your content. This is pretty simple:

    1
    2
    3
    4
    5
    
            if (Stage.width < Stage.height)
            {
                _root._rotation = 90;
                _root._x = 360;
            }
    (Or if you’re anti-`_root`, wrap everything in a ‘content’ movie clip, etc.)
  3. The Device class also affects how your user can interact with input text fields. These are something that have been problematic in Flash Lite since they were introduced; with the Device class, things are getting somewhat better. The one thing to keep in mind is that the orientation of the phone when the user starts your app affects how they can input text. If the phone is held in portrait mode, the user cannot access the full-screen QWERTY keyboard, only the mini QWERTY, handwriting, or ‘keypad’ style of input. But, if the phone is in landscape mode when your app is started, then the user can access full-screen QWERTY (although it may not be the default input mode).

I’ve put together a simple example you can try out on your 5800 to see how this all works. You can try starting the swf in different orientations, and try commenting out the stage width/height check to see what happens if you don’t.