I recently ran into a real mess when trying to persist a typed singleton object in a Flex Mobile application via the PersistenceManager class.
DevGirl Holly Schinsky has a great blog post on managing data in a Flex Mobile application, and I was specifically using her instructions on persisting typed objects. The basics are this:
1.) Register the class alias
flash.net.registerClassAlias("person",model.Person);
2.) Get an instance of the PersistenceManager class
var persistenceManager : PersistenceManager = new PersistenceManager();
3.) Save the object to be persisted
persistenceManager.setProperty("savedData", _personInstance);
persistenceManager.save();
4.) Re-load the object at a later time
persistenceManager.getProperty("savedData");
Everything works totally fine UNLESS the object you're persisting has a hidden internal class - a class who's scope is internal to the model object class itself. This is often the case for singleton classes in AS3 - since there's no way to make a private constructor the best-practice for singletons in AS3 is to make the constructor take an instance of an internal class object so that no external classes can call the constructor.
I suspect the error is during de-serialization - since the serializer can't make an instance of your singleton model's internal class, it can't make the model class itself at all, and de-serialization fails.
For now I'm just removing the internal classes from my singleton. It means it's no longer really secure, but I'll take the easy data persistence and built-in serialization of the PersistenceManager over having to do the serializing/de-serializing myself.
I suspect this would be an issue with any AMF serialization in Flash - I bet these types of locked singleton's can't be persisted across the client/server or to a regular LSO or anything like that either.
A Better Experience
everyone hates bad interfaces.
Saturday, July 2, 2011
Thursday, April 14, 2011
Amazing client quote
Regarding EUI's work for Pearson recently, the product manager for our client said:
Wow, that's amazing feedback. It feels great to be a part of the EffectiveUI team when we get this sort of feedback. :)
“Each of you probably had your own reasons for getting into this business, but I'm sure the hope was improving people's lives. That's what you've done here, one student, one class, one non-missed exam at a time. That's something to be proud of.”
Wow, that's amazing feedback. It feels great to be a part of the EffectiveUI team when we get this sort of feedback. :)
Tuesday, January 18, 2011
HTML5 Logo Background Images
Friday, October 29, 2010
MAX Volume presentation is live
My presentation at MAX 2010 with Juan Sanchez and Leonard Souza is up now on AdobeTV. We presented on MAX Volume - a multi-screen experience we built for the desktop and mobile phone using Adobe tools.
Monday, September 20, 2010
Doug McCune Is Not Dead
Doug McCune is not really dead, but I gave his eulogy this morning as part of a prank that Nate Beck organized, produced and masterminded this morning at 360|Flex. Nate and Doug have had something of a prank war going in their sessions at 360|Flex over the past year and this was Nate's latest salvo, based on my April Fools Day post "RIP Doug McCune" earlier this year.
Here's the full text of the eulogy. It was immediately followed by this video that Nate posted to weheartdoug.org, which was in turn followed by Doug himself, giving his part of the keynote here at 360 | Flex.
Friends and honored guests, members of the Flex community. I stand before you today to with a message of sadness. Our once merry and mirthful friend, Douglas Quincy McCune, passed away last week and so will be unable to give the keynote here this morning. I know that Doug was a good friend to many of you and an honored member of the Flex community, remembered for the fanciful (if occassionally inappropriate) titles he gave to his sessions and frequent exhibitionism. There is no doubt that Doug will be sorely missed this weekend.Though details of Doug's demise and the real reason for his passing are not available at his time, I would ask that we all honor his memory by thinking more about the happy times we had with him than the surely tragic and unfortunate events that surround his shuffling off of the mortal coil. For myself, the thing I remember most about Doug was the way he filled a room - how his presence permeated the place. Though I know Doug has passed on, in a weird six-sense sort of way I can still feel that presence, that warmth, that joy of his here with us know - as if he were sitting right in the front row.Many of you know that Doug and Nate Beck had a prank war going. It started when Nate threw rubber balls at Doug during a session. Doug retailiated by having a man dressed as marilyn monroe sing happy birthday to Nate in the middle of his session at the last 360 Flex. Nate Beck was planning a masterful rebuttal; an epic final stroke to end the war by escalating it so far that Doug couldn't possibly respond. He'd hired a troupe of dancers to can-can out during this very keynote. They were to be lead by Michael Labriola who, contrary to common misperception, is quite a nimble ballerina. But due to Doug's passing Nate immediately dropped the prank plans and focused all of his efforts on rallying the Flex community in memorial with Doug. He's prepared a short memorial video, which we will watch together now.
We <3 Doug - In Memoriam from Nate Beck on Vimeo.
Monday, June 28, 2010
Installing new Flash Player in Chrome
The illustrious Kevin Suttle turned me on to a fix for an issue I've been having with Flash Player and Google's Chrome browser, which is my favorite browser by far.
My flash player debugger had simply stopped working in Chrome without warning. It turns out that Flash Player comes bundled as a plugin with Chrome now and you have to visit chrome://plugins to disable it. The only way to install a new Flash Player version for Chrome is to disable the old one, shut down chrome, run the Flash Player installer, and then restart Chrome.
When you're done, check out this Flash Player version test page from Adobe to make sure everything worked.
My flash player debugger had simply stopped working in Chrome without warning. It turns out that Flash Player comes bundled as a plugin with Chrome now and you have to visit chrome://plugins to disable it. The only way to install a new Flash Player version for Chrome is to disable the old one, shut down chrome, run the Flash Player installer, and then restart Chrome.
When you're done, check out this Flash Player version test page from Adobe to make sure everything worked.
Friday, June 4, 2010
Making a site specific browser for Campfire using Fluid
Step 1: Make the new fluid isntance. Grab the high-res image for Campfire from 37Signals here.
Step 2: Add *launchpad.37signals.com* to your list of allowed URLs for browsing (thanks Steve Sanderson)
Step 3: Add scripts to to do things like growl notifications when someone says your name.
Step 4: FUN
Subscribe to:
Posts (Atom)