Titanium Community Questions & Answer Archive

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

how to pass on data to from one window to other ?

I tried this code but it does not works.

In app.js, I could define a function and a property.

var a = 1;
function b()
return "hello";

Creating a new window by this:
var w = Titanium.UI.createWindow({

assigning a and b to a new window reference w.
w.a = a;
w.b = b;

But when I access a and b in w , it shows undefined for both.

How will I pass on data then ?

— asked September 4th 2010 by Avinash Arora
  • iphone4

2 Answers

  • You can

    1. Send and receive custom events between Windows with parameters.
    2. Store and retrieve app parameters like Setint or GetInt, etc.

    Check them out at the api reference.

    — answered September 4th 2010 by Peter Lum
    • Hi Peter , thanks a lot for your instant response.
      1) Can you please give one example.
      2) If I use setInt and getInt then, will variables become global ? I think they will be global and will not be garbage collected until application exits. I donn't want to happen that.

      — commented September 5th 2010 by Avinash Arora
    • I tried for custom event. Data is passed but event is not fired always. Sometimes it is not fired. Any solution on this ?

      — commented September 5th 2010 by Avinash Arora
  • — answered September 5th 2010 by Avinash Arora
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.