Issue: Objects passed through the AIR SandboxBridge lose their type

If you attempt to pass a JavaScript Date through the Adobe AIR SandboxBridge, it loses its type and appears only as Object.

Solution: Send the date in milliseconds from a known base time

The example code below demonstrates how you can serialize and deserialize the date so that its object type is maintained.

// Sending the number of milliseconds since 1 January 1970 00:00:00
myDate = new Date("January 1, 2008");
dateLong = myDate.getTime();

// ~~~ Bridge ~~~

mySameDate = new Date();
mySameDate.setTime(dateLong);

Additional information

Prototype methods of objects are not serialized across the interface; only the object's properties are sent.

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy