You can do something like this :
  
// This will run only when the call to the service is back ...
public function OnResult(event:ResultsEvent):void
{
  // Do your stuff here ....
 
}
    <mx:RemoteObject id="classifiedCFC" destination="ColdFusion" 
source="applications.Classifieds.CFCs.classifiedapp" 
showBusyCursor="true"  result="onResult(event)"/>

--- In flexcoders@yahoogroups.com, "David Brown" <[EMAIL PROTECTED]> wrote:
>
> I am writting a login function that calls a remote cfc and returns 
data.  Based on the length of lastresult either show different view 
stack child or turn visiable on for label that displays no user found
> 
> The remote call works, but I have to press login button twice to 
display the no user found message or to switch to another child of 
the view stack.
> 
> It looks like the if statment exacutes before the remoteobject is 
returned...
> 
> Thank you in adance.
> 
> David
> 
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; 
layout="absolute" creationComplete="logincall();">
>      <mx:Script>
>         <![CDATA[
>    import mx.logging.LogEvent;
>    /* import flash.events.MouseEvent;*/
>    import mx.events.FlexEvent; 
>    import mx.styles.CSSStyleDeclaration;
>          import mx.effects.*;
>    import mx.events.*;
>          import mx.rpc.events.*;
>          import mx.controls.Alert;
>    import mx.managers.PopUpManager;
>    import flash.events.Event;
>             import mx.events.MenuEvent;
>             import mx.controls.Alert;
>             import mx.collections.*;
>             import flash.net.*;
>             
>    public function checkRecordCount():void{
>     if (classifiedCFC.qryLogin.lastResult.length==0){
>      lblFailedLogin.visible=true;
>     }
>    }
>    
>     
>             public function logincall():void{
>          classifiedCFC.qryLogin(fldemployeeID.text,fldssn.text);
>    if (classifiedCFC.qryLogin.lastResult.length==0){
>      lblFailedLogin.visible=true;
>     }
>    else{
>     vsappId.selectedChild=Main;    
>     }
>    
>    }
>    
>             [Bindable]
>             public var menuBarCollection:XMLListCollection;
>       public var selectedItem:Object;
>       public function clickEvt(event:ItemClickEvent):void {
>                 // Access target TabBar control.
>                 var targetComp:TabBar = TabBar(event.currentTarget);
> //                GetQCCQues.qryQccQuesWidget(event.label);
>     }   
>          ]]>
>     </mx:Script>
>  <mx:RemoteObject id="classifiedCFC" destination="ColdFusion" 
source="applications.Classifieds.CFCs.classifiedapp" 
showBusyCursor="true" />
>  <mx:ViewStack x="32" y="25" id="vsappId" width="622" height="494">
>






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