SetFullScreen (and other fscommands)

May 27th, 2008

Hayden asked about the ability to go fullscreen when launching a swf from within the browser. I don’t know about Javascript-based methods to do this, but here’s what I’ve figured out about that in terms of Flash Lite. I thought I’d also tack on some interesting bits about a couple of fscommands, namely SetSoftKeys and ExtendBacklightDuration.

The swf cannot access fullscreen mode itself, so this sounds like the same situation as with SE FL 1.1 phones. If the browser is in fullscreen mode to begin with, then the swf will run in fullscreen mode. Any calls to SetFullScreen in the swf are ignored.

SetSoftKeys exhibits behaviour that I can only describe as wacky: there appears to be a delay of approximately five seconds before the command is actually executed. If you start a swf that has a SetSoftKey call in the first frame, it does not take effect right away, so for a brief period of time you can still access the regular browser functions with the soft keys (menu for the left button, back for the right). But then, once the SetSoftKey ‘takes effect’, it effectively locks up the browser. I tried one swf and, until I realized that the ‘end call’ button acts as a sort of kill command to the browser, had to keep restarting the phone to be able to get out of that swf. Perhaps this is the standard behaviour for SE phones, but if so, it seems an unfortunate decision. It would seem better to not allow the remapping of the keys at all than to create a situation where it seems impossible to exit a swf.

Lastly, ExtendBacklightDuration. This works as expected, although it appears that interacting with the accelerometer will reset the backlight duration to the default. If you’re creating a game/app where the only means of interaction is via the accelerometer – and so there is an extended period of time where the user is not pressing any buttons on the phone – the backlight will turn off. This, obviously, is not the optimal user experience.

Luckily, there’s a dead simple way around this. Just throw the following code into your movie, and you won’t have to worry about the problem:

function keepBacklightOn() {
     fscommand2("ExtendBacklightDuration", 5);
}
var lightInterval:Number = new Number();
lightInterval = setInterval(keepBacklightOn, 5000);

This just creates an interval that will set the backlight duration to 5 seconds; the interval is run every 5 seconds, so the effect is to keep the light on all the time. You just have to remember to turn this off if/when you don’t need it – if the user is interacting with a menu, or if the game is paused, for example – to avoid draining the battery unnecessarily.

Accelerometer notes, Part 1

May 26th, 2008

Having had a few days to play around with the accelerometer on the W910i, I have to say that it’s a lot of fun. It’s not without its idiosyncrasies, though. The first one that I’ve discovered makes me wonder if there needs to be another category for Flash Lite implementation, in addition to the usual standalone, browser, wallpaper, etc. modes. Perhaps it could be called ‘pseudo-standalone’.

I think the W910i could be described as having a pseudo-standalone implementation of Flash Lite, because of how the accelerometer is handled – or not – by Flash Lite files, depending on the context in which they’re started. If a swf is loaded from a web server, it will not be able to load accelerometer data; the vars into which the data gets passed (accX, accY, accZ) remain as empty strings. If the same swf is copied to the phone memory and started via the file manager, it will work as intended. When you start a swf in that manner, and hit the left soft key, you get the standard web browser menu choices. So the swf is clearly loading via the browser, but the browser ‘knows’ that it didn’t get loaded via an http connection. (I’m assuming that the browser is allowing or denying the loadVariables call to the accelerometer data.)

W910i font bug

May 25th, 2008

Just posting this in case anybody else runs into this problem: device fonts in Flash Lite 1.1 files do not display on the SE W910i (a FL 2.1 phone). The fonts do display if the same swf is opened on a Nokia E65 (FL 1.1 pre-installed). If the FL 1.1 fla is published as a FL 2.x file, the fonts will show up on the W910i. Anybody else encountering this on other SE phones with FL 2+ installed?