Flex 2.0 with CFMX 7.0.2 - SUCCESS!!
1. On the local machine without CFMX 7.0.2, put the default services-config.xml file (from CFMX 7.0.2) into: C:\CFusionMX7\wwwroot\WEB-INF\flex (create the folder, if you don't have it already).
2. When you create your flex app, specify the following by right-clicking on the application name (from within the Navigator in the top-left box) and choosing properties:
a. Flex Compiler tab -> Additional compiler arguments ->
3. Now, FTP up your cfc into the folderofyourapp folder.
4. In your flex app, reference your RemoteObject's source as folderofyourapp.cfcname (without the .cfc at the end)
5. When you Save and Run your app in flex, you'll need for FTP up the .html and .swf files into your folderofyourapp/projectname/bin/filename (.html and .swf) and then Run again to actually see them.
This requires NO editing of the services-config.xml file.
Notes:
1. By using Web Services (mx:WebService tag) you don't need to do anything at all with this. Just point to the wsdl file and you're all set. However, this uses bloated XML for moving the data.
2. You can try to set your endpoint in the mx:RemoteObject, but this will use regular old flash remoting (the old one prior to Flex 2) which is better than XML, but aparently not compacted binary.
3. Using the method I described above uses AMF the new flash binary compressed format, which should be much faster and allow for future integtraion of Flex Data Services.
Thanks to Jeff Houser for his great article at: http://coldfusion.sys-con.com/read/256202.htm
Thanks also to everyone who tried to help me figure this out at: http://www.forta.com/blog/index.cfm/2006/2/1/ColdFusion-Flex-2-Sample-Application and http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?catid=585&threadid=1169105&highlight_key=y&keyword1=7%2E0%2E2
Please comment on this entry, if you found this a useful way to run Flex 2 and Cold Fusion MX 7 together.

"I wonder if all this issue simply boils down to (all of) us needing help better understanding what parts of the Flex Builder Wizard setup steps regard the config of the local machine on which development is taking place versus what parts relate to the actual server on which deployment will take place.
Looking at it another way, many have used RDS features in connection with a localhost to do page creation, and then later deployed that code on a remote server. What we have here is an obvious need to get more info on what parts of the setup of the wizard need to reflect the server WHERE THE CODE WILL BE DEPLOYED."
That Flex Server Tab entry for the Flex server URL seems to be the key, right?.
I have been trolling your posts for hours now and I am facing a major problem. My web host is using CF 7.0.1 (the update to 7.0.2 is being applied), but I cannot wait for them to update before I deploy some portions of my app.
Would you happen to know how I can use Flex 2 with that version for remoting? I know you mentioned setting the endpoint, but when I do, I am faced with the TypeError #1034, implicit coercion error.
Am I going to be forced to use Web Services to connect to my CFCs?
I'm sorry - I haven't successfully run it with the old flash remoting Endpoint, but have been told it should work.
Perhaps Jeff or Charlie has successfully done this and can chime in?
Homestly, I'm amazed at how much time this took me to do! It seems like everyone who's building Flex apps would have the same problem. However, it was very reassuring that Peter Ent mentioned that Adobe will add my steps into their next set of documentation!
I agree, too, about the wizard (etc.) being focussed on where the code will be deployed. Just makes sense to me. Yes, the 'Flex Server Tab -> Flex Server URL' was the key. Strangely enough, however, the services-config.xml (which is part of CFMX 7.0.2) file needs to be on your LOCAL machine for compile, even if you don't have any CF running locally. Then (I think) it uses the values from the Flex Server URL field to fill in those special variables (server) that everyone else is trying to set manually.
It occurred to me that there may be many people who don't have the ability to pull down this file from a real CFMX 7.0.2 box, so I'll put the original one here below.
Put the following file (in the next comment) in: C:\CFusionMX7\wwwroot\WEB-INF\flex\services-config.xml on your LOCAL machine (create the necessary folders, if needed). Technically, this file can be anywhere, as long as you specify it in your 'Flex Compiler tab -> Additional compiler arguments' field, but I just put it in the default location to make things simpler.
Well, I tried to put the code in here, bur for some reason the <code> blog tag didn't work here. I moved it to it's own separate comment below.
I hope this has been helpful to someone else like me who spent 2 months trying to figure out this stuff (which should have been automatic and/or obvious on day-1!).
Ken.
<services-config>
<services>
<service id="coldfusion-flashremoting-service"
class="flex.messaging.services.RemotingService"
messageTypes="flex.messaging.messages.RemotingMessage">
<adapters>
<adapter-definition id="cf-object" class="coldfusion.flash.messaging.ColdFusionAdapter" default="true"/>
</adapters>
<destination id="ColdFusion">
<channels>
<channel ref="my-cfamf"/>
</channels>
<properties>
<source>*</source>
<!-- define the resolution rules and access level of the cfc being invoked -->
<access>
<!-- Use the ColdFusion mappings to find CFCs, by default only CFC files under your webroot can be found. -->
<use-mappings>false</use-mappings>
<!-- allow "public and remote" or just "remote" methods to be invoked -->
<method-access-level>remote</method-access-level>
</access>
<property-case>
<!-- cfc property names -->
<force-cfc-lowercase>false</force-cfc-lowercase>
<!-- Query column names -->
<force-query-lowercase>false</force-query-lowercase>
<!-- struct keys -->
<force-struct-lowercase>false</force-struct-lowercase>
</property-case>
</properties>
</destination>
</service>
</services>
<channels>
<channel-definition id="my-cfamf" class="mx.messaging.channels.AMFChannel">
<endpoint uri="http://{server.name}:{server.port}{context.root}/flex2gateway/" class="flex.messaging.endpoints.AMFEndpoint"/>
<properties>
<polling-enabled>false</polling-enabled>
<serialization>
<instantiate-types>false</instantiate-types>
</serialization>
</properties>
</channel-definition>
</channels>
<logging>
<target class="flex.messaging.log.ConsoleTarget" level="Error">
<properties>
<prefix>[Flex] </prefix>
<includeDate>false</includeDate>
<includeTime>false</includeTime>
<includeLevel>false</includeLevel>
<includeCategory>false</includeCategory>
</properties>
<filters>
<pattern>Endpoint.*</pattern>
<pattern>Service.*</pattern>
<pattern>Configuration</pattern>
<pattern>Message.*</pattern>
</filters>
</target>
</logging>
<system>
</system>
</services-config>
For those who would be interested, and as most CF-related Flex 2 articles do highlight the usee of FR via 7.02, it would be helpful to point out some articles on doing integration via web services. Ken, you've mentioned in the comments on Ben's blog that you've previously worked with Flex and web services. Do you have any good references to point folks to? Kenny? I did some digging and found that the bottom of this article (on Flex 2 and 7.02) does indeed show also how to change it to do web services as well:
http://www.adobe.com/devnet/flex/articles/hellowor...
I would suspect there were others posted in the time between Flex 2 being released and the 7.02 updater (or the early release of the "the CF adapter" which it included).
I am having trouble getting this to work. I am developing everything locally (using IIS w/ CF Developer Edition) and I cannot get rid of this error. Any ideas would help greatly. Is their something I missed during the install?
GOOD WORK ON FOLLOWING THROUGH!
I made a tutorial after following the steps you advised.
<a href="http://axel.cfwebtools.com/index.cfm/2006/12/13/Im..." target="_blank">http://axel.cfwebtools.com/index.cfm/2006/12/13/Im...</a>
the tutorial is on that page...
What I'd like to know is how to get the wizard to generate the code so that it points the remote object to the correct source without having to do a search and replace each time I need to regenerate the code:
Example:
my APP ROOT:
http://localhost/sites/flex/db1
the file location:
is c:\sites\flex\db1
App Wizard Assumes it's being deployed off the webroot.
Realistically, most of us don't expect to deploy their crud apps off the webroot. More likely scenerio we'd deploy webroot /admin or /webapps or /flex etc.
So is this a limitation of the app wizard? Or can one "configure" the wizard to use a more accessable webroot and site folder?
Examples:
One needs to change this:
<mx:RemoteObject
id="dataManager"
showBusyCursor="true"
destination="ColdFusion" source="db1.components.cfgenerated.companies">
<mx:method name="getMasterQuery" result="getMasterQuery_result(event)" fault="server_fault(event)" />
<mx:method name="deleteItem" result="deleteItem_result(event)" fault="server_fault(event)" />
</mx:RemoteObject>
to to this:
<mx:RemoteObject
id="dataManager"
showBusyCursor="true"
destination="ColdFusion" source="sites.flex.db1.components.cfgenerated.companies">
<mx:method name="getMasterQuery" result="getMasterQuery_result(event)" fault="server_fault(event)" />
<mx:method name="deleteItem" result="deleteItem_result(event)" fault="server_fault(event)" />
</mx:RemoteObject>
http://axel.cfwebtools.com/index.cfm/2006/12/13/I-...
I'm hosting with crystaltech.com and struggling to get the Phones app working.
You said:
"4. In your flex app, reference your RemoteObject's source as folderofyourapp.cfcname (without the .cfc at the end)"
Where exactly in the Server Properties do I enter this? I have three text entry boxes named:
Root Folder
Root URL
Context Root
Also, do I need to know where my CFIDE is located. One of the errors that was thrown up says it can't find the CFIDE path. Surely I would need to make changes to services-config.xml depending on where CFIDE is located.
Cheers,
Paul
http://www.dir-9.com
http://www.automotive-repair-manual.net/
Andrzej Filipowicz
Still life Artist, still life art
http://www.andrzejfilipowicz.com
STILL LIFE PAINTING
http://www.life.e-phils.com