I wonder which one of these methods is the best when trying get a variable from anotherClass to the Main-document-class, and why? Are there any more, even better ways?
In example no 1, and the Main-function, can the if-else statement be triggered before the checkLogin function was completely done? Thanks!
My no 1. way
public class Main extends MovieClip {
// Declaring other classes.
    private var checkLogin:CheckLogin;
    public function Main() {
        checkLogin = new CheckLogin();
        if(checkLogin.isLoggedIn == true) {
            trace("Is logged in");
        } else {
            trace("Not logged in");
        }
    }   
}
and
public class CheckLogin {
    public var isLoggedIn:Boolean;
    public function CheckLogin() {
        isLoggedIn = false;
    }
}
Or is it a lot better to do it this way, (Way no 2):
public class Main extends MovieClip {
    // Declaring other classes.
    private var checkLogin:CheckLogin;
    public function Main() {
        checkLogin = new CheckLogin();
        checkLogin.addEventListener("checkLogin.go.ready", checkLoginReady);
        checkLogin.go();
    }
    public function checkLoginReady(event = null) {
        if(checkLogin.isLoggedIn == true) {
            trace("Is logged in");
        } else {
            trace("Not logged in");
        }
    }
}
and
public class CheckLogin extends EventDispatcher {
    public var isLoggedIn:Boolean;
    public function CheckLogin() {
        isLoggedIn = true;
    }
    public function go() {
        this.dispatchEvent(new Event("checkLogin.go.ready"));
    }
}
 
    