Crystallize
Crystallize

Reputation: 110

Titanium & Alloy - Opening a new View fails?

I've started working on an Alloy & Titanium project, and i need to create a new window with a new view. I've already created the files, and created the controller and view in my index.js file.

function onListClick(e) {
    var win = Alloy.createController('controlPage').getView();
    win.open();
}

This is the code that is supposed to open the new View, but...

Uncaught TypeError: Object View has no method "open"

I've immediately checked the online reference, and there actually is no module "open" inside the Ti.UI.View object.

What am i supposed to do? controlPage.xml (and the relative .js and .tss file) do exist.

Upvotes: 0

Views: 133

Answers (1)

StephenFeather
StephenFeather

Reputation: 921

Well,

is controlPage.xml:

<Alloy>
  <Window>
  </Window>
</Alloy>

If it is, then you can win.open() since window objects have an open() method

If however, you actually have a view as your title, the references to Ti.UI.View, etc indicates, then you would need to add your view to a parent container.

Upvotes: 1

Related Questions