You gave the answer yourself: the css is called via an asynchronous call. In the meantime javascript will proceed. You can solve this with (pseudo):
this.loadCSSDFiles(this.myLoginFunction);
},
myLoginFunction: function () {
mx.Login();
}
At the end, (or return of async call) of loadCSS.. call the callback function.
This is often done in widgets.