I have some simple code that should update some dynamic text but it seems to be doing it out of order.

Code:
function loginAttempt() {
_root.txt_progressbar.text = "Attempting to login, please wait..."; 
var valid_login = _root.check_login(_root.txt_username.text,_root.tx t_password.text);
if (valid_login == true) {
mdm.Forms.Menu.setFocus();
mdm.Forms.Menu.show();
mdm.Forms.CTBCC.alpha=0;
}
}
The txt_progressbar.text is not being updated until the function finishes.