Label

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

hi team!! i have a question probably its simple or maybe it is not but I'm try to have a label link to a .js file..when someone click the label it goes to the file...please help team..i got errors

var label = Ti.UI.createLabel;
 
if (e.item == 'label'){
        //Click al segundo RoW
        var newWindow = Ti.UI.createWindow({
            title : 'email',
            backgroundColor : 'white',
            url:'email.js'
 
        });
        var backBtn = Ti.UI.createButton({ title : 'Back' });
 
backBtn.addEventListener('click', function(){
    newWindow.close();
});
newWindow.setLeftNavButton(backBtn);
        newWindow.open({
            modal : true,
            animated : true
});
 
}
});

1 Answer

Accepted Answer

Hi Ronny,

Use below code, Hope it will work

var label = Ti.UI.createLabel({
     text:"Open Email Window",
});
 
label.addEventListener('click', function(){
        var newWindow = Ti.UI.createWindow({
            title : 'email',
            backgroundColor : 'white',
            url:'email.js'
        });
        newWindow.open();
});
in email.js
var win = Ti.UI.currentWindow;
 
var backBtn = Ti.UI.createButton({ 
     title : 'Back' 
});
 
win.setLeftNavButton(backBtn);
 
backBtn.addEventListener('click', function(){
    win.close();
});

Your Answer

Think you can help? Login to answer this question!