|
Mailing Lists
|
Home /
Groups /
Adobe Flex
connecting Flex & ColdFusion
Hi,John Barrett 12/14/09 12:09 A On 12/14/2009 2:00 PM, John Barrett wrote:Paul Hastings 12/14/09 01:40 A Hi Paul,John Barrett 12/14/09 03:03 A On 12/14/2009 4:51 PM, John Barrett wrote:Paul Hastings 12/14/09 04:26 A Hi paul,John Barrett 12/14/09 06:55 A Hi, I am trying to connect CF & Flex with remoting. I got flex set up for remoting, and I have this flex code: <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="initApp()"> <mx:Script> <![CDATA[ import mx.rpc.events.ResultEvent; import mx.collections.ArrayCollection; [Bindable] private var acArtists:ArrayCollection; private function initApp() :void { ArtistGateway_RO.getArtist(); } private function getArtistsRO_Handler(event:ResultEvent):void { acArtists = ArrayCollection(event.result); } ]]> </mx:Script> <mx:RemoteObject id="ArtistGateway_RO" destination = "ColdFusion" source ="com.cfcs.ArtistGateway"> <mx:method name="getArtists" result = "getArtistsRO_Handler(event)" /> </mx:RemoteObject> <mx:DataGrid dataProvider = "{acArtists}" right="10" left="10" top="10" bottom="10"> </mx:DataGrid> </mx:Application> my cfc is located in localhost/com/cfcs/ArtistgateWay.cfc <cfcomponent output="false"> <cffunction name="getArtists" access="remote" returntype="query"> <cfset var qRead = "" /> <cfquery datasource="cfartgallery" name="qRead"> SELECT artistid, firstanme, lastname, email FROM artists </cfquery> <cfreturn qRead /> </cffunction> </cfcomponent> when I run the appication I get an flash player error saying can't find coldfusion component? Am I doing something wrong? Flex is looking at com as http://localhost/com right ? Thanks so much, Johnny On 12/14/2009 2:00 PM, John Barrett wrote: > <mx:RemoteObject id="ArtistGateway_RO" destination = "ColdFusion" source ="com.cfcs.ArtistGateway"> is "com" under the web root or cf mapped? if cf mapped, did you change remoting-config.xml use mapping option to true? <!-- Use the ColdFusion mappings to find CFCs, by default only CFC files under your webroot can be found. --> <use-mappings>true</use-mappings> Hi Paul, Thanks so much for your help! the file is locate in the webroot (not sure if this is a best practice, but just on localhost for testing) /Documents/Library/WebServer/com/cfcs/ArtistGateway.cfc (http://localhost/com/cfcs/ArtistGateway.cfc) I have not set any mappings, and I have checked in services-config.xml and mappings are set to true. I think that Flex is looking for a function getArtist, but the method is getArtists. I wrote a blog on this,maybe the blog is more clear, and I have tested the cfc which is working properly too: http://hawaiiflash.net/blog/post.cfm/database-results-flex Thanks so much! Johnny ----- Excess quoted text cut - see Original Post for more ----- <use-mappings>true</use-mappings> On 12/14/2009 4:51 PM, John Barrett wrote: > I think that Flex is looking for a function getArtist, but the method is getArtists. I wrote a blog on this,maybe the blog is more clear, and I have tested the cfc which is working properly too: > http://hawaiiflash.net/blog/post.cfm/database-results-flex sorry, should have read your email more closely: your error is flex side, your init method is trying to call getArtist() which doesn't exist on that service. private function initApp() :void { ArtistGateway_RO.getArtist(); } Hi paul, Thanks so very much!! I looked at the code over and over and never saw this silly error:( I even wrote a full blog post saying that flex did not like plural methods of maybe it was a caching issue, but I see it was a sill typo of mine:) I change this little error and all works, I can't thank you enough`-` Here is the post if you are interested: http://hawaiiflash.net/blog/post.cfm/database-results-flex I did manage to learn how to use the Alerts to post the error. I feel pretty good that I am finally getting Flex & CF a little, but it is a slow process for me! Thanks again, Johnny`-` ----- Excess quoted text cut - see Original Post for more ----- }
|
March 22, 2010
|
Latest Fusion Authority Articles
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||