I am opening a window like so in my app.js
Ti.App.addEventListener('launchVforum', function(event) { var vforum = Ti.UI.createWindow({ url:'windows/vforum.js', vforumLocation:event.vforumLocation, vforumTitle:event.vforumTitle, username:event.username, navBarHidden:true, fullscreen:true }); if (Ti.Platform.osname != "android") { vforum.modal = true; } vfTitleHolder = event.vforumTitle; vforum.open({modalTransitionStyle: Titanium.UI.iPhone.MODAL_TRANSITION_STYLE_COVER_VERTICAL}); vforum.addEventListener('close',function(event) { Ti.API.error("settings vforum to null"); vforum = null; }); Ti.App.addEventListener('closeVforum', function(event) { vfTitleHolder = ''; vforum.close(); }); });That all works fine, the window opens and that's great. When I go back on android and reopen the vforum window, it opens again and thats good.
My issue is when I rotate the device, my orientationchange event that lives in vforum.js gets fired twice and causes my app to crash. As you can see above, I set vforum to null when it receives the close event. That even fires.
Inside vforum.js I even call a Ti.Gesture.removeEventListener('orientationchange', orientationHandler); when the window is closed. It still gets fired twice and the app crashes.
How can I completely destroy the vforum window when it is closed?
Your Answer
Think you can help? Login to answer this question!