Web Design Resources & Tutorials to help you design the best website!
Here is a very simple example in how you can populate a DataGrid using the cfartgallery database that comes standard with ColdFusion 8.
My Workspace Folder is under wwwroot subfolder in the ColdFusion8 Directory
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="myDatabase.databaseInformation()"> <mx:Script> <![CDATA[ import mx.collections.ArrayCollection; import mx.controls.Alert; import mx.rpc.events.ResultEvent; [Bindable] private var myCollection:ArrayCollection; private function onResultEvent(event:ResultEvent):void { myCollection = event.result as ArrayCollection; } ]]> </mx:Script> <mx:RemoteObject destination="ColdFusion" source="AdobeFlex.src.cfc.DatabaseCFC" id="myDatabase"> <mx:method name="databaseInformation" result="onResultEvent(event)" fault="trace(event.fault)"/> </mx:RemoteObject> <mx:DataGrid dataProvider="{myCollection}"/> </mx:Application>
Name of the CFC is DatabaseCFC
<cfcomponent output="false"> <cffunction access="remote" name="databaseInformation" returntype="query"> <cfquery datasource="cfartgallery" name="artGalleryDatabase"> SELECT * FROM ART </cfquery> <cfreturn artGalleryDatabase> </cffunction> </cfcomponent>

Hottest Posts