Forum BigDB Nested objects BigDB using AS3

Discussion and help relating to the PlayerIO database solution, BigDB.

Nested objects BigDB using AS3

Postby brunn » January 15th, 2011, 5:20 am

Hey folks

How can I create nested objects in BigDB using the AS3 api ?

In the serverside c# code I can easily do object.nestedobject.property = "value";
But I've not been able to do the same using AS3, I can't just use the "double dot" notation.

I also tried assigning a previously initialized Database Object (ie o.property = DatabaseObjectInstance)
and it shows up as null.
brunn
 
Posts: 11
Joined: January 8th, 2011, 6:45 pm

Re: Nested objects BigDB using AS3

Postby Benjaminsen » January 15th, 2011, 11:36 am

As AS3 is somewhat more dynamic than C# we simply use basic types for nested data such as objects and array.

Thus you can simply do:

Code: Select all
//where o is a reference to a database object
o.myobject = {}
o.myobject.property1 = 5;
o.myobject.property2 = "test"
o.myarray = []
o.myarray[0] = 5
o.myarray[1] = "test"


You can naturally also use inline notation:

Code: Select all
//where o is a reference to a database object
o.myobject = {property1:5,property2:"test"}
o.myarray = [5,"test"]
Benjaminsen
.IO
 
Posts: 1444
Joined: January 12th, 2010, 11:54 am
Location: Denmark


Return to BigDB



cron