Search code examples
titanium-mobiletitanium-alloy

Call another.js view from alloy.js titanium


have 1st view = index.js 2nd view = another.js

global file alloy.js

I have called the global class (alloy.js) method from index.js and now i want to move to another.js view but after httpRequest method finishes (which is declared and implemented in alloy.js).

---alloy.js---

Alloy.Global.httpMethod=function(){

//xml response is achieved, now from here i want to navigate to another.js view

}

---index.js---

Alloy.Global.httpMethod();

---another.js---

//some UI objects.

Solution

  • The first thing you want to do is create a controller, your another.js must be a Controller, it can be created by doing Right click on app and creating a new controller from there.

    Once your controller is created, you can easily do what Phil said in the comment. i.e

    Alloy.createController('another').getView().open();

    This has to be placed in your onload function of HttpClient.

    Hope it Helps.