ご挨拶、
appcelerator のボタンのテキストを変更しようとしています。
一度変更できるようになりましたが、何らかのイベントが発生すると、テキストを元に戻すことはできません。
コードは次のとおりです。
var login=Titanium.UI.createButton({
title:'Login',
width:250,
top:330
});
win.add(login);
var xhr=Titanium.Network.createHTTPClient();
login.addEventListener('click', function(e){
login.title="Please wait..."; //this line works fine
xhr.onload=function(){
login.title="Login"; //this line doesn't work
if(uname.hasText){
uname.value=this.responseText;
}
};
xhr.onerror=function(){
login.title="Login"; //this line doesn't work
alertDialog.show();
};
xhr.open("POST","http://www.asdf.com/ajax/login.php");
if(uname.hasText && pword.hasText){
xhr.send({"uname":uname.value,"pword":pword.value});
}else{
alertDialog.show();
}
});
この時点で何をすべきかわかりません!
どんな洞察も大歓迎です。
よろしくお願いします。