4

I was wondering if it is possible to do custom serialization of Arrays/ArrayCollections in as3 via amf. To be more specific, i want to be able to pool objects on the client so that im not instantiating new objects every time i make a RemoteObject call. I tried using IExternalizable but that only lets me serialize the objects myself not instantiate them. The flash player is still instantiating objects itself and them letting me set the object state via readExternal. Thanks in advance.

/E

HorseFace
  • 385
  • 3
  • 12
  • Why do you want to do this? Keeping lots of objects up in memory may be bad for the application's memory management. That said, using the Factory design pattern should allow you to pool objects on the client. You'll have to write your own code but there is no reason you can't encapsulate creation and serialization into a single component. – JeffryHouser Aug 31 '10 at 11:16
  • I don't see why you would want to serialize when you aren't going to save them, but if that is what you want to do, go ahead. If you want to do custom serialization, you should look into the usage of Base64 or the usage of JSON. – Michiel Standaert Jun 09 '11 at 08:14

3 Answers3

0

Convert Arrays and ArrayCollections to JSON and pass them around as a string?

hidarikani
  • 1,121
  • 1
  • 11
  • 25
0

AMF is completely built into the flash player, I don't think there's any way of messing with the parsing, BUT you could skip the native AMF, get a AMF (or something else) open source library and tamper with its parsing function.

I don't know if there IS a open source AMF library for flash since it has a native one, but who knows.

Flassari
  • 1,149
  • 8
  • 13
0

You can have your class implement IExternizable to do its own serialization.

Check out The Dark World of IExternizable

Richard Haven
  • 1,122
  • 16
  • 31