Travel plans for MAX

July 20th, 2009

My travel plans for Adobe MAX are all set. I’ll be arriving in L.A. on the Saturday (October 3) before MAX and heading back to Winnipeg on the morning of Thursday the 8th. I’m booked at the Millennium Biltmore Hotel, which is about a mile away from the conference site. It would’ve been nice to stay a little closer, but the rates at the conference hotels were so much higher than the rate I’m paying at the Biltmore, I could travel back and forth by cab about 5 times a day if I wanted to and still save money.

Looking forward to seeing the Flash Lite diehards once again! It’s been an interesting year so far, and there will no doubt be a good deal of discussion about how things are going in the various corners of the mobile Flash world.

Now I just need to register for the conference itself!

Quirks with the Device object

July 9th, 2009

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:
    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.


When to save Shared Object data

July 9th, 2009

(I ran up against this problem a couple of months ago, and when it happened again today I’d completely forgotten about how I’d fixed it, so this is more a note-to-self than anything else…)

My past practice has been to write data to the Shared Object right before the fscommand2("quit") call, on the assumption that this would ensure that it would capture the most recent data, and nothing would be lost. This has worked fine up until the Nokia 5800, which handles this kind of strangely.

In the process of testing a game, I transferred the swf to the phone via Bluetooth, so it was in my messaging inbox. When I launched the game from there, it would save the data as expected, and so the data would be waiting for me when I launched the game again. All’s well so far.

Next step was to package the game into a sis file. When it was installed from the sis and launched from the icon in the Apps folder, the game would not save data upon exit. Very odd. Even odder was that if I navigated directly to the installed swf and launched the game from there, it would save data.

My best guess as to the cause of the problem is that the manner in which a swf is started and stopped when it’s installed from a sis file somehow interrupts the normal manner in which this occurs. I’m not sure of the hows or the whys, but this seems to be what’s happening.

Luckily, the fix is pretty simple: just make sure that you’re saving your data a short period of time before the app quits. In my case, to exit the game you return to the main menu, press the ‘quit’ button, then press ‘yes’ on the confirm screen. I modified the code so that the save data function is called when you return to the main menu screen. Even if you press the required buttons fairly quickly, this still gives a second or two for the data to be saved. In my case, that’s plenty of time, but be sure to test your application to make sure it’s sufficient for your app.


Nokia 5800 Landscape bug in Device Central

July 5th, 2009

Working on some landscape-oriented content for the 5800, and happened across a rather annoying bug. I haven’t tested to see if I can reproduce this on a Windows machine, but it occurs in Device Central CS3 and CS4 on the Mac. When I’m in Device Central and rotate the phone (so it’s landscape instead of portrait), the emulator no longer responds to button presses.

To reproduce:

  1. Create a new .fla, and place a button on the stage. Add some behaviour so that you know that you’ve clicked on the button (i.e. configure the ‘down’ state or add an onRelease, etc.).
  2. Test the movie using the Nokia 5800 profile in Device Central. By default, it will start in portrait mode (i.e. screen is taller than it is wide). Click your button to confirm that it works as you’d expect.
  3. Using the buttons in the bottom corner of Device Central, rotate the phone clockwise or counter-clockwise. Now try clicking your button again. The button no longer responds for me at this point. (The file works fine on the actual phone.)

Suggested workaround:

  1. Keep phone in portrait mode, tilt head 90 degrees during testing.
  2. Make appointment with your local massage therapist.