Don’t rely on the order!

When using data in a format of array/JASON, don’t pull out the data based on the index of the object in the array/JASON. The reason is very obvious but wa always ignored: data would be disarrayed when items are inserted, deleted, or the order of the items are changed.

Instead, something (JASON) like this can be used:

var data:Object = {d0:”hello”, d1:new Array(), d2:new SimpleButton(), d7:123456};


One drawback is now it takes a second line to really access the real data you need:

for (var j in data){if(j.indexOf(“d”, 1)) var info:Object = data[j]; }


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: