Search code examples
titaniumtitanium-mobile

how to close a window(JS file1) from another window's(JS file2) click event in Titanium Appcelerator


I have created an App using Titanium appcelerator. Here i have 3 JS files with seperate "Window" for each. Is it possible to close the 2nd JS file's "window", when i click on a button in 3rd JS file. I have tried it by passing 2nd Window name to 3rd JS file & then close it on button click event,but it didn't worked!


Solution

  • Write this in window where button is

    Ti.App.fireEvent('customEvent', nil); 
    

    And this in which window is to be closed

    Ti.App.addEventListener('customEvent', function()
    {
       window.close();
    });