Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Add the above line in your each file which containing the new window, since you're opening new windows using url method.</p> <pre><code>var currentWindow = Ti.UI.currentWindow; </code></pre> <p>Then close the window as follows</p> <pre><code>imgView.addEventListener('click', function(){ currentWindow.close(); }); </code></pre> <p>This will close the current window, since <a href="http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.UI-property-currentWindow" rel="nofollow">currentWindow</a> represents the active window</p> <p>I'll add the working Example : </p> <p><strong>app.js</strong></p> <pre><code>var win = Ti.UI.createWindow({ backgroundColor : 'white' }); var back = Ti.UI.createButton({ title : 'To win1 ', width : '70%' }); back.addEventListener('click', function(){ var win1 = Ti.UI.createWindow({ url : 'win1.js', backgroundColor : 'white', layout : 'vertical' }); win1.open(); }); win.add(back); win.open(); </code></pre> <p><strong>win1.js</strong></p> <pre><code>var self = Ti.UI.currentWindow; var back = Ti.UI.createButton({ title : 'Back to home', top : 20, width : '70%' }); var next = Ti.UI.createButton({ title : 'To win2', top : 20, width : '70%' }); self.add(back); self.add(next); back.addEventListener('click',function(){ self.close(); }); next.addEventListener('click', function(){ var win2 = Ti.UI.createWindow({ url : 'win2.js', backgroundColor : 'white', layout : 'vertical' }); win2.open(); }); </code></pre> <p><strong>win2.js</strong></p> <pre><code>var self = Ti.UI.currentWindow; var back = Ti.UI.createButton({ title : 'Back to win1', top : 20, width : '70%' }); self.add(back); back.addEventListener('click',function(){ self.close(); }); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload