Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: Serialization Proxy - AIR  (Read 9821 times)
Rhysyngsun
Courseware Beta
Sr. Member
***
Posts: 51

Nathan Levesque

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

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



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

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

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 Email
« Reply #2 on: March 19, 2008, 10:17:35 »

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

Pages: [1]
Print