Display alert message only once

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

I have a button, on click an alert appears and a new win will open.

button1.addEventListener('click', function(){
    var win1 = Ti.UI.createWindow({
        url:'some.js',
  })
 
  {
    alert("Hello! You will only se me once :)");
}; 
    win1.open();
});
Is it possible to display this alert only once (it will never appear again)?

1 Answer

Accepted Answer

you can use boolean property to set this like

Ti.App.appear = true;
Ti.App.appear = false;
 
button1.addEventListener('click', function(){
    var win1 = Ti.UI.createWindow({
        url:'some.js',
  });
 
 if(Ti.App.appear == false){ 
    alert("Hello! You will only se me once :)");
    Ti.App.appear = true;
}
    win1.open();
});

— answered 1 year ago by Mitul Bhalia
answer permalink
3 Comments
  • Getting this error

    [ERROR] Script Error = Result of expression 'Ti.App' [undefined] is not an object. at start.js (line 124).

    — commented 1 year ago by Markus Renström

  • try to clean the project from project menu and try again

    — commented 1 year ago by Mitul Bhalia

  • Thanks for your help! Very grateful :)

    — commented 1 year ago by Markus Renström

Your Answer

Think you can help? Login to answer this question!