Alert display late in tagged AS code

I wanna create a app with login page, I am testing the alert function
with login unsuccessful.

After loaded the first page, I don't know why the alert will show when
I click the button second time. I have test by Network Monitor, I can
get the xml content in my first click, but I don't know why the value
save into AS code after I click one more!

true.html
================================================================
<results><ans>false</ans></results>

index.mxml
================================================================
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml";
horizontalAlign="center" verticalAlign="middle">
    <mx:HTTPService id="loginSrv" url="http://127.0.0.1/true.html";>
    </mx:HTTPService>
<mx:Script>
<![CDATA[
        function checkLogin(){
        var loginOK = true;
        loginSrv.send();
        loginOK = loginSrv.result.results.ans;
                if (loginOK == false){
                                alert('Your login ID or password is not 
correct!', 'Warning');
                }
        }
]]>
</mx:Script>
  <mx:Panel title="Login Page" autoLayout="true" creationPolicy="queued">
    <mx:Label text="Login ID:" id="lblid"/>
    <mx:TextInput id="txtid" />
    <mx:Label text="Password:" id="lblpw"/>
    <mx:TextInput id="txtpw" password="true" />
    <mx:ControlBar horizontalAlign="right" id="cbar">
      <mx:Button label="Login" id="btnlogin" click="checkLogin();"/>  
      <mx:Button label="Cancel" id="btncancel" />
    </mx:ControlBar>
  </mx:Panel>
</mx:Application>





------------------------ Yahoo! Groups Sponsor --------------------~--> 
Get fast access to your favorite Yahoo! Groups. Make Yahoo! your home page
http://us.click.yahoo.com/dpRU5A/wUILAA/yQLSAA/nhFolB/TM
--------------------------------------------------------------------~-> 

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to