Create Custom Objects in AS3

181 views
Skip to first unread message

Mav

unread,
Apr 7, 2012, 5:21:03 PM4/7/12
to cocoafi...@googlegroups.com
I see an example for creating a custom object in REST in the API reference docs, I wonder if it would it be possible to do so in AS3?

Wei Kong

unread,
Apr 7, 2012, 5:21:46 PM4/7/12
to cocoafi...@googlegroups.com
yes you can do the same, just need to make sure to send the same json string.

___________________
Wei Kong
Co-Founder | Cocoafish
mobile: 415-533-1853

Mav

unread,
Apr 7, 2012, 8:48:06 PM4/7/12
to cocoafi...@googlegroups.com
I'm trying to create a new custom Class Object in AS3:

var data:Object = new Object();

var _fields = new Object();
_fields.status = "active";
_fields.value = 2000;
_fields.property = 1000;
_fields.start_time = "2012-11-02 17:07:37 -0700";
_fields.end_time = "2013-11-02 17:07:37 -0700";

data.fields = _fields;

sdk.sendRequest("objects/Raffle/create.json", URLRequestMethod.POST, data, false, callback);


Even though the Object I am setting is traced to be the correct format, in the callback, I am always getting the same "Missing fields" in the message returned. Am I doing anything wrong?

Wei Kong

unread,
Apr 9, 2012, 12:18:10 AM4/9/12
to cocoafi...@googlegroups.com
Hi Mav,

The custom object fields definition should be a json in string type instead of object, currently you passes in an object, this is why the call failed.

Wei
Reply all
Reply to author
Forward
0 new messages