Flex 4 & Remoting

First the ColdFusion component has not changed

<cfcomponent displayName= "testConn">
	<!--- Establish a Flash Remoting Connection --->
	<cffunction name="getTestConn" access="remote" returnType="string">
        <cfreturn "connection to the ColdFusion 9 Server was successful">
   </cffunction>
</cfcomponent>

The Flex code is a little different and strangely I get quotes return here in the text field, but the same code ran in Flash or even Flex 3 returns no quotes.

The Flex Code with using the Flex 4 SDK & Spark

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
			   xmlns:s="library://ns.adobe.com/flex/spark"
			   xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
	<fx:Script>
		<![CDATA[
			import mx.rpc.events.ResultEvent;
			import mx.utils.ObjectUtil;

			private function getTestConn_handler( event:ResultEvent):void {
				Result.text = ObjectUtil.toString(event.result);
			}
		]]>
	</fx:Script>

	<fx:Declarations>
		<mx:RemoteObject id="testConn" destination="ColdFusion" source="testConn">
			<mx:method name="getTestConn" result="getTestConn_handler(event)" />
		</mx:RemoteObject>
	</fx:Declarations>

	<mx:Label id="Result" x="127" y="22" width="395" textAlign="left" fontFamily="Verdana" color="#655E5E"/>
	<mx:Button x="10" y="21" label="Test Connection" click="testConn.getTestConn()"  cornerRadius="5" focusColor="#E6EBF0" chromeColor="#F4F6FA" width="109"/>

</s:Application>

So what has changed in remoting in the new Flex SDk & Flash Builder 4? Not much really.

  • New namespaces
  • the script is wrapped in <fx:Script>
  • the mx:RemoteObject is placed in theĀ  <fx:Declarations>
  • afterwards I have a button and a text field which gets the data from the cfc

okay everything is working, but for the life of me I can get rid of the quote:(


Any ideas to this?