Ok... makes sense. I will have to read your AS code closer to
understand what it is doing. I am very new to AS so i am slowly
learning.
The code is working, but not returning a value to the textarea.
I am watching the traffic with a program called serviceCapture and i
can see the data going back and forth, but for some reason the
text="{resultString}" in the textarea is not working.
Thanks again!
--- In [email protected], "Clint Tredway" <[EMAIL PROTECTED]>
wrote:
>
> Thats not how remoting works. By sending an object to the server,
the
> gateway translates it into a or many structures that is in the
argument
> scope of CF.
>
> to pass a string to a CFC do this:
>
> public function sendToCFC():void{
> var cfObj:Object = {input:source.text};
> myFlashRemote.echoString(cfObj);
> }
>
> Now what this does is send an AS object through the gateway that
will inturn
> translate this into a structure with input as an argument with the
value of
> the send textfield's text.
>
> Now, when you return something from the CFC, its best to bind that
to a
> Bindable variable.
> In this case I would create a bindable var called
returnString:String and in
> my result function do this.
>
> public function setReturnString(event:ResultEvent):void{
> returnString = event.result as String;
> }
>
> To get to the result of your CFC call, a result function needs to be
> specified or else the app will not know what to do with the result.
>
> Here is your code changed to show how it all works.
>
> <?xml version="1.0" encoding="utf-8"?>
> <mx:ApolloApplication xmlns:mx="http://www.adobe.com/2006/mxml"
> layout="absolute" pageTitle="Flex Remoting Example">
> <mx:Script>
> <![CDATA[
> import mx.rpc.events.ResultEvent;
>
> [Bindable]
> public var resultString:String;
>
> public function sendToCFC():void{
> var cfObj:Object = {input:send.text};
> myFlashRemote.echoString(cfObj);
> }
>
> public function setReturnString(event:ResultEvent):void{
> returnString = event.result as String;
> }
> ]]>
> </mx:Script>
> <mx:RemoteObject id="myFlashRemote" destination="ColdFusion"
> source="test" endpoint="http://demo.dev/flex2gateway/">
> <mx:method name="echoString" result="setReturnString
(event)"/>
> </mx:RemoteObject>
>
> <mx:Button x="141" y="280" label="Button" click="sendToCFC()" />
>
> <mx:TextArea id="source" width="356" height="201"
text="{resultString}"
> x="10" y="10"/>
>
> <mx:TextInput x="101" y="229" id="send" text="Hello out
there,"/>
>
> </mx:ApolloApplication>
>
> On 22 Mar 2007 07:02:11 -0700, rchadgray <[EMAIL PROTECTED]> wrote:
> >
> > Ok now I am starting to break down Clint's example so I
understand
> > what is going on. I tossed out the AS just to kind of make me
> > understand how the tags are working together.
> >
> > My question now is why cant I do this in my button click event:
> > myFlashRemote.echoString({send.text})"
> >
> > Here is my current code and it works, but I want the text entered
> > into the TextInput tag to be passed to the remote object. Right
now
> > I have static text in myFlashRemote.echoString()
> >
> > <?xml version="1.0" encoding="utf-8"?>
> > <mx:ApolloApplication xmlns:mx="http://www.adobe.com/2006/mxml"
> > layout="absolute" pageTitle="Flex Remoting Example">
> >
> > <mx:RemoteObject id="myFlashRemote" destination="ColdFusion"
> > source="test" endpoint="http://demo.dev/flex2gateway/">
> > <mx:method name="echoString" />
> > </mx:RemoteObject>
> >
> > <mx:Button x="141" y="280" label="Button"
> > click="myFlashRemote.echoString('a232322323')" />
> >
> > <mx:TextArea id="source" width="356" height="201"
> > text="{myFlashRemote.echoString.lastResult}" x="10" y="10"/>
> >
> > <mx:TextInput x="101" y="229" id="send"/>
> >
> > </mx:ApolloApplication>
> >
> > My CFC:
> > <cfcomponent>
> > <cffunction name = "echoString" returnType = "string" output
> > = "no" access = "remote">
> > <cfargument name = "input" type = "string">
> > <cfset returned = arguments.input & "chad said">
> > <cfreturn returned>
> > </cffunction>
> > </cfcomponent>
> >
> >
> >
>
>
>
> --
> http://indeegrumpee.spaces.live.com/
>