Home > database >  Actionscript 3.0: How to communicate between main window and popup window untill main window gets se
Actionscript 3.0: How to communicate between main window and popup window untill main window gets se

Time:10-06

We are working in a project where we are designing the GUI in action script 3.0.

The login screen will do a http call with the opensso server for autherntication and if the login fails, the error popup window should be displayed.

Now the problem is that sometimes the authentication takes a long time and the end user doesn't know the situation. So he is clicking the LOGIN button once again. So the client wants another popup window which should display only WAIT till the server sends the login response.

This is our ssoAuthenticate method -

private function ssoAuthenticate():void
{
    var loaderUrl:String = FlexGlobals.topLevelApplication.loaderInfo.url;
    var myLoadBaseUrl:LoadBaseUrl = new LoadBaseUrl();
    var ssoBaseUrl:String = myLoadBaseUrl.getSSOUrl();
        
    var url:String = ssoBaseUrl.concat("opensso/json/authenticate");
    var srv:HTTPService = new HTTPService();
    srv.url = url;
    srv.method = "POST";
    srv.contentType = "application/json";
    srv.headers ={
        "X-OpenAM-Username": userName,
        "X-OpenAM-Password": password,
        "Content-Type": "application/json"
    }
    var data:Object = new Object();
    srv.resultFormat = "e4x";
    srv.addEventListener(ResultEvent.RESULT, authenticateSuccess);
    srv.addEventListener(FaultEvent.FAULT, authenticateFailed);         
    srv.send("{}");
}

How we can make it happen? How we can introduce another WAIT popup in this code? And that popup window should disappear whenever the event ResultEvent.RESULT comes back from the server.

Any pointer will be highly appreciated. Thanks

CodePudding user response:

when your user click on the login button call login.removeEventListerner(MouseEvent.CLICK,ssoAuthenticate) until ResultEvent.RESULT comes back from your server also for better UX you are able to show a loader movieclip or progress dialog like this https://docs.airnativeextensions.com/docs/dialog/progress-dialog

  • Related