Skip navigation
Currently Being Moderated

Fairly certain that FileStream.writeObject() and FileStream.readObject() do not function - at all -.

Jan 18, 2013 7:28 AM

Tags: #air #flex #actionscript #air3 #bytearray #actionscript_3.0 #filestream #4.7 #writeobject #readobject

I've struggled with this since Jan 9th, 2013 (if not longer) and the only conclusion I can come to is that this simply does not function.  No matter what I try and no matter what resource (and I'm finding precious few) I follow to try to implement this within Flash Builder 4.7, Flex SDK 4.6.0 (Build 23201), AIR SDK 3.5, I only succeed in creating a file (with the correct name) that is 123 bytes in size that reads back in as NULL;

 

I've tried using ByteArray.writeObject()/readObject() as an intermediary with FileStream.writeBytes()/readBytes(), with no luck.

 

I've tried instantiating an object, setting properties and then using that.  I've tried instantiating my correctly formed ValueObject (including the remoteClass alias metadata tag).

 

I've tried using -verbatim- the example provided in the top most suggested 'Community Help' resource http://www.switchonthecode.com/tutorials/adobe-air-and-flex-saving-ser ialized-objects-to-file It is worth noting that this solitary example of the procedure/SDK-usage is dated to Flex SDK 3.0 and at least 04/04/2009 (first comment on the article).

 

My frustrating hell (one version of many methods attempted) is detailed on StackOverflow (including -all- mxml, as, and trace output), but so far, no assistance has been forthcoming, alas.  This is a severely stripped down and simplified version of what had been a far more complex attempt:

http://stackoverflow.com/questions/14366911/flex-air-actionscript-mobi le-file-writeobject-readobject-always-generates-null-w

 

An earlier post* detailing a far more complex attempt interation, with, alas, just as little help (guess this isn't a hot button topic) forthcoming:

http://stackoverflow.com/questions/14259393/flex-actionscript3-filestr eam-writeobject-fails-silently-in-ios-what-am-i-doin

 

* I previously suspected that it was only failing from within iOS on an iPad, but the first example (the stripped down version) made it evident that it didn't work in the AIR mobile device simulator (iPad) in the Windows environment, and indeed, didn't work in a non-mobile project in the windows environment AIR launcher.

 

I'm at a loss, upset, frustrated, in major trouble with my supervisor/deadlines, etc.

 

I would very much appreciate any suggestions/help/confirmation/etc.

 

Just to move ahead with development I've opted for a far less preferable solution of writing out both an XML file and a JPG file.  I very much do not like this and very much want to store encapsulated serialized objects locally in the same way I assume will work for storing remotely with AMFPHP (if the project ever gets to that point *sigh*).

 

Again.  Would be so grateful for any help.

 
Replies
  • Currently Being Moderated
    Jan 18, 2013 1:44 PM   in reply to Bramblethorne

    Hi,

     

    It looks like you have Re: Fairly certain that FileStream.writeObject() and FileStream.readObject() do not function - at all -. instead of Re: Fairly certain that FileStream.writeObject() and FileStream.readObject() do not function - at all -..  Could that be the issue?  But either way, I don’t think BitmapData can be serialized.  I think you have to create a custom serializer for it.

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 18, 2013 8:43 PM   in reply to Bramblethorne

    Well, metadata is not restricted to a known set of keywords.  There are some the compiler knows about, but you are allowed to add your own, as many MVC and other application frameworks did.

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 18, 2013 8:46 PM   in reply to Bramblethorne

    Somewhere I think we documented that displayobjects are not serializable.  I don’t know if BitmapData counts among that or not, but I wouldn’t be surprised if it doesn’t reconsititute itself.

     

    http://stackoverflow.com/questions/1361558/displayobject-serializing

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 22, 2013 4:58 PM   in reply to Bramblethorne

    Ah yes, you are correct that BitmapData is not a DisplayObject.  But did it serialize correctly?  I don’t trust that anything in the flash.display package will.  Almost everything in that package is backed by non-AS objects internal to the player.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points