Trouble working with modules

You must Login before you can answer or comment on any questions.

Hi im new working with modules so i started to try a simple module that sends a simple label, this is the code i acctually have below i my principal code

var win= Ti.UI.createWindow({
 
    backgroundColor: 'white'
});
 
var vista = require ('interfaz');
 
var scre = new vista.login();
 
win.add(scre);
win.open();
this is the module code named "interfaz" this is supposed to send a label to the main code
function login () {
 
    var show=function(){
 
     var letrero=Ti.UI.createLabel({
 
            color:'#999',
            text:'Ingrese Password',
            font:{fontSize:40,fontFamily:'Helvetica Neue'},
            textAlign:'center',
            top: 180,
            width:'auto'
        });
 
        return letrero;
    };
 
 
 
}
 
exports.login=login;
I dont know what im missing the fact is that it doesnt works neither shows any label on the emulator, as i said im new at this so i need if anybody can help me to find the solition to this trouble or can give me and advice about this topic i will really aporeciate it

1 Answer

Accepted Answer

seems to be a typo

function login () {
 
    // var show=function(){ REMOVED
 
     var letrero=Ti.UI.createLabel({
 
            color:'#999',
            text:'Ingrese Password',
            font:{fontSize:40,fontFamily:'Helvetica Neue'},
            textAlign:'center',
            top: 180,
            width:'auto'
        });
 
        return letrero;
   // }; REMOVED
}

— answered 9 months ago by Aaron Saunders
answer permalink
5 Comments
  • Im still having an issue in this line

    var scre = new vista.login();

    — commented 9 months ago by Erik Daniel Rodriguez Zepeda

  • var v = new vista();
    var scre = v.login();

    — commented 9 months ago by Aaron Saunders

  • Still the same D:

    Message Uncaught TypeError object is not a function Source var v = new vista();

    — commented 9 months ago by Erik Daniel Rodriguez Zepeda

  • Show 2 more comments

Your Answer

Think you can help? Login to answer this question!