George
George

Reputation: 15551

ActionScript 3.0: Serialization of functions?

Since Function is just another type I was wondering. Is it possible to serialize functions in actionscript 3.0?

Upvotes: 2

Views: 886

Answers (2)

mrkishi
mrkishi

Reputation: 5942

With AS3, Adobe gave us enough power to create, modify and run ByteCode at run-time. You can achieve a 'function serialization' using this runtime bytecode concept.

This can get pretty technical, but I recommend you to read about some libraries that should help you:

Libspark's swfassist

Hurlant's AS3Eval

I should also point that AS3Eval should be easier to understand -- swfassist have no english documentation, as far as I can tell. With AS3Eval you can modify code as a string and execute it at real-time, just like the old eval method.

Of course you can go hardcore style and implement a complex system on bytecode reading/serializing, but using such libraries would make it pretty simple.

Upvotes: 3

CookieOfFortune
CookieOfFortune

Reputation: 13984

Do you mean to serialize not just the pointer to the function, but the actual function contents and then send them to a remote machine? I do not believe you can do that, you would have to use some type of remoting to do something like that.

Upvotes: 0

Related Questions