cfSrvc.init() just starts the process of calling your CFC.  The 
results are handled asynchronously at some future point in time by 
calling the result handler, initRecord() in your case.  So, until 
initRecord() has been called, the recordID variable will remain 0.  
If you need to do something with the results of your CFC, initRecord
() is the place to do it.

Take a look at the Using RPC Components section of the docs, or 
check this list for threads on asynchronous service calls if you 
want some more information.

- Doug

--- In [email protected], "Abdul Qabiz" <[EMAIL PROTECTED]> 
wrote:
>
> recordID is untyped, could it be the reason?
> 
> var recordID:uint = 0;
> 
> Check if it works ?
> 
> -abdul
> 
> On 6/15/06, Doug Arthur <[EMAIL PROTECTED]> wrote:
> >
> >   Hi, I'm trying to call a cfc and put the results into a 
bindable public
> > var and use that on the page. But the problem is that when I 
call the method
> > on the cfc, it doesn't put the value into the var immediately as 
expected...
> > Here's the code, maybe that'll be more helpful:
> >
> >
> > <mx:RemoteObject id="cfSrvc" destination="ColdFusion"
> >      source="flexapps.new.viva.components.model.Record"
> >      showBusyCursor="true">
> >   <mx:method name="init" result="initRecord(event)" />
> >  </mx:RemoteObject>
> >
> >
> >  <mx:Script>
> >   <![CDATA[
> >    import mx.rpc.events.ResultEvent;
> >
> >    [Bindable]
> >    public var recordID = 0;
> >
> >    public function initRecord(event:ResultEvent):void {
> >     var record = event.result;
> >     recordID = record.recordID;
> >     trace('initRecord method: ' + recordID);
> >    }
> >
> >    public function addRecord():void {
> >     cfSrvc.init();
> >     trace('addRecord method: ' + recordID);
> >    }
> >
> >
> >
> > Logically I'd think what should happen here is that when 
addRecord() is
> > invoked, the init() method on the cfc should be invoked, then 
the value from
> > the cfc is inserted into the recordID var and then the process 
continues...
> > But instead, the init() method is getting invoked, the addRecord
() method is
> > completing before the values from the initRecord bind to the var.
> >
> > Here's the trace results
> > addRecord method: 0 // <---- This should not be before 
initRecord since
> > this trace logically comes afterwards because cfSrvc.init() 
invokes
> > initRecord()...
> > initRecord method: n
> >
> >
> > What am I missing here???
> >
> > Thanks!
> > - Doug
> >
> >  
> >
>






------------------------ Yahoo! Groups Sponsor --------------------~--> 
Something is new at Yahoo! Groups.  Check out the enhanced email design.
http://us.click.yahoo.com/SISQkA/gOaOAA/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