Skip to main content
Participant
May 20, 2008
Question

CF8 install to work with Flex 3

  • May 20, 2008
  • 1 reply
  • 321 views
...well Flex 3 or other flash remoting...

I've been doing CF coding for a while now. A year or so ago I tried to do some flash remoting but could never get the flash to talk to CF. I could get the CF to provide XML to the flash component but I could never talk to the CFC's directly. I ended up scrapping the flash and finished the coding in CFML.

Now, I've got a little spare time and I thought I'd learn Flex 3. Things in my dev environment have changed a small amount; I went from CF7 to CF8. Thinking that CF8 had better support for flex/flash I started trying to connect to the CF CFC again and have run into the same issues all over again.

I've dug over the past two weeks looking for anything that could be causing the issue (the component has public access and I can now see connection errors). I'm pretty sure that it's coldfusion at this point. In the administrator I've got the flash remoting and RDS enabled.

I've tried coldfusion on linux and win2k3 with the same results. I actually has less luck with flex builder with coldfusion running on linux.

What am I missing to allow connection to CF from a flash/flex component?
This topic has been closed for replies.

1 reply

Inspiring
May 22, 2008
Hi,

From your Flex application, you want to use the RemoteObject MXML tag (<mx:RemoteObject />). As long as Flash Remoting is available in the CFAdmin, which you indicated it is, it should work. I've done/do this running CF8 on Mac OS X, Linux, and Win 2003.

Here's a sample of MXML code for this.

<mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()">
<mx:Script>
<![CDATA[
import mx.rpc.events.FaultEvent;
import mx.collections.ArrayCollection;
import mx.rpc.events.ResultEvent;
import mx.controls.Alert;

[Bindable]
private var myAC:ArrayCollection;

//runs on creationComplete event of mx:Application tag
private function init():void{
this.ro.getAll();// call the method on your CFC when app inits
}

private function gotEm(event:ResultEvent):void{
myAC = new ArrayCollection();
myAC.source = event.result as Array;
}
private function oops(event:FaultEvent):void{
Alert.show(event.fault.toString());
}
]]>
</mx:Script>

// the remote object, which connects to CF via FlashRemoting
<mx:RemoteObject id="ro" destination="ColdFusion" source="webroot.appfolder.cfcfolder.cfcname">
<mx:method name="getAll" fault="oops(event)" result="getEm(event)" />
</mx:RemoteObject>

// DataGrid to hold results..naturally you would make this nicer :)
<mx:DataGrid id="dg" dataProvider="{myAC}"/>
</mx:Application>

Have you tried similar code? It's often helpful to see some code you're having trouble with, if that's possible.

Hope this helps!
Craig
Inspiring
May 23, 2008
Hi,

I read one interesting blog other day, it says CF8 has the ability to compile Flex Applications.

Go here!..