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

Thanks for the great answers here…

I have a similar project, except that 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:

Ti.App.friends[dynamic.id].name

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:

Ti.App.friends[0].name

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
1 Comment
  • i am assuming this is a dup of http://developer.appcelerator.com/question/81141/global-arrays

    — commented November 18th 2010 by Aaron Saunders

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.