Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Welcome, Guest. Please login or register.
August 16, 2017, 02:34:38 PM
Home Help Search Login Register
News: Please DM @puremvc on Twitter to gain forum access. Spambots are why we can't have nice things.
Pages: [1]
Print
Author Topic: Serialization Proxy - AIR  (Read 9191 times)
Rhysyngsun
Courseware Beta
Sr. Member
***
Posts: 51

Nathan Levesque

rhysyngsun@gmail.com rhysyngsun
View Profile WWW
« on: March 18, 2008, 10:54:34 PM »

Just thought I'd share this little tidbit of code I wrote tonight. It's mostly a helper class, but handles opening the files and running the appropriate functions you pass to it.

It allows for either synchronous or asynchronous read/write of data to local files on AIR using a FileStream.

If you go synchronous you simply pass a function that takes a FileStream as its only parameter and serializes your data to it.

For asynch, you need to create an object that implements either/both of IFileReadResponder or IFileWriteResponder and pass it to the asynch methods. Put the read/write code in the onComplete method, should probably rename it for clarity.

I've also attached a mini AIR app that tests the synchronous code (haven't yet fully tested the asynch code, but fairly sure it works).

You'll also have to excuse the lack of comments (will do at later date), but much of the code is pretty self explanatory.
Logged

puremvc
Global Moderator
Hero Member
*****
Posts: 2870



View Profile WWW
« Reply #1 on: March 19, 2008, 08:31:18 AM »

Hey Nathan,

I haven't run the code, but I checked it out. This looks pretty useful. I think it needs to be worked into a demo and utility in the repository. Just make sure the asynch stuff works. And if you wouldn't mind throwing some ASdoc on the methods, I can generate it. You could too, but most people are baffled by the process at the moment is why I offer. Smiley

If anybody else sees some functionality that should go here, please comment on this thread.

Thanks,
-=Cliff>
Logged
Rhysyngsun
Courseware Beta
Sr. Member
***
Posts: 51

Nathan Levesque

rhysyngsun@gmail.com rhysyngsun
View Profile WWW
« Reply #2 on: March 19, 2008, 10:17:35 AM »

I've got the documentation working, just working through some bugs in the async code now.
Logged

Pages: [1]
Print
Jump to: