Last updated on
Apr 27, 2021
|
Also applies to AIR SDK
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.