Coldfusion component


<cfcomponent>
<cffunction name="GetHello" output="false" access="remote" returntype="string">
    <cfreturn "Hello World">
    </cffunction>
</cfcomponent>

Flex


<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">

    <mx:Script>
        <![CDATA[
            import mx.rpc.events.ResultEvent;
            import mx.utils.ObjectUtil;

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

    <mx:RemoteObject id="helloWorld" destination="ColdFusion" source="HelloWorld">
        <mx:method name="GetHello" result="GetHello_handler(event)" />
    </mx:RemoteObject>

    <mx:Label id="Result" x="59" y="58" width="87"/>
    <mx:Button x="154" y="56" label=" Get Hello" click="helloWorld.GetHello()" />
</mx:Application>

By |2009-12-12T21:22:05+00:00December 12th, 2009|