Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Close a window in a commonjs module returns : Window is not open. Ignoring this close call

$
0
0

Hi all,

I'm trying to use commonJS pattern to create a window. When I close it for the first time It works. but after this I have this message ;

Window is not open. Ignoring this close call
here is my code :
function Recorder(message) {
    //create object instance, a parasitic subclass of Observable
    var self = Ti.UI.createWindow({
        backgroundColor : '#2f3645',
        navBarHidden : true,
        layout : 'vertical',
        left : myApp.width,
        top : 0,
        width : myApp.width,
        height : myApp.height
    });
var fermer = function() {
        self.close();
    };
function onSipEvent(_event) {
 
        Ti.API.info('onSipCall ' + JSON.stringify(_event));
        var caller = '';
        if (_event.caller) {
            var match = _event.caller.match(/sip:(.*)(?=@\w+\.\w{2,6})/g);
            if (match && match.length > 0)
                caller = match[0].replace(/sip:/i, '');
            else
                caller = _event.caller;
        }
        if (_event.type === "call.incoming") {
            // do nothing
        ..........
 
        } else if (_event.type === "call.ended") {
            finAppel();
 
        }
    }
function finAppel() {
        sipCalling = false;
        //akylas_sip = null;
        Ti.API.info("call ended");
        buttonPoster.action = 'call';
        // boite de dialogue pour conserver le mp3
        var dlg = Titanium.UI.createAlertDialog({
            message : L('conserver'),
            buttonNames : [L('oui'), L('non')]
        });
        dlg.addEventListener('click', function(ev) {
            if (ev.index == 1) {// clicked "No"
                ........
            } else {
                Ti.API.info('fermer');
        /************ this call does not work the second time***********/
                fermer();
            }
        });
        dlg.show();
    }
}
I use the module like this :
var Recorder = require('ui/common/Recorder');
var recorder = new Recorder(message);
my env : Titanium Command-Line Interface, CLI version 3.2.3, Titanium SDK version 3.2.3.GA iOS SDK: 7.1

Thx for your help :)

Sylvain


Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>