Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Global Arrays of Objects

I'm trying to pass an array of objects, so:

I would like something like:

Ti.App.friends[8342873] = {
   name: "Mike",
   age: 26,
   height: 6.1

But when I call:


I get an error friends [undefined]. Any ideas?

I tried another syntax:

Ti.App.friends = [{
   name: "Mike",
   age: 26,
   height: 6.1

But then I have to call:


Which works, except I need to call each friend by id, not by the index of the array.

I would really appreciate some help on this, thanks!

— asked November 18th 2010 by Michael Newell
  • arrays
  • global
  • iphone
  • objects
  • variables
1 Comment
  • Mike, it would be good if you would clear the contents of these duplicate posts, so that it's clearer for people to know which was the correct one.

    — commented November 19th 2010 by Paul Dowsett

0 Answers

The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.