you need add a "eventlistner" in your code:

 loginSrv.send();
 //loginOK = loginSrv.result.results.ans;
 loginSrv.addEventListner("complete",myAnyFunction);

 ...
 }

 function myAnyFunction(event:Event)
 {
 .....
  // see the event parameter in your debug, see the parameter
  // event.currentTarget too!
 }

Bye,
 Daniel [from Brazil]



--- In [email protected], "Tracy Spratt" <[EMAIL PROTECTED]> wrote:
>
> 
> You cannot do this:
> >     loginSrv.send();
> >     loginOK = loginSrv.result.results.ans;
> 
> Data service calls are asynchronous.
> http://www.cflex.net/showfaq.cfm?Object=faq&channelID=1&faqtype=&default
> fields=&defaultValues=#Question371
> 
> Tracy
> 
> -----Original Message-----
> From: [email protected] [mailto:[EMAIL PROTECTED] On
> Behalf Of endofadam228
> Sent: Sunday, November 20, 2005 4:30 AM
> To: [email protected]
> Subject: [flexcoders] Re: Alert display late in tagged AS code
> 
> Hi all Flex developer
> 
> I really need your help!
> 
> Please, thank you very much!
> 
> --- In [email protected], "endofadam228"
> <[EMAIL PROTECTED]> wrote:
> >
> > 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>
> >
> 
> 
> 
> 
> 
> 
> 
> 
> --
> 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
>








------------------------ 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