Flash Web Services and dataproviders tip
I have been playing with web services and components in Flash MX 2004. I discovered that if I do the following the data passed from the Cold Fusion web service is in a format Flash can treat as a dataprovider. Neat.
***Cold Fusion Web Service***
<cffunction name="productlist" access="remote" returntype="array" output="yes">
<cfquery name="qProducts" datasource="operatorsPostgres">
SELECT * from tablename
</cfquery>
<cfset aRetvar=arrayNew(1)>
<cfoutput query="qProducts">
<cfset singleItem = structnew()>
<cfset singleItem["productname"]= ProductName >
<cfset singleItem["producttype"]= ProductType>
<cfset arrayAppend( aRetvar, singleItem )>
</cfoutput>
<cfreturn aRetvar/>
</cffunction>
***Action Script Call***
productObj = mapService.productlist( result.flashmapuuid , _global.domainid, _global.cfid , _global.cftoken , _global.thrivedsn );
productObj.onResult = function(result) {
_root.application.form.dgProducts.dataProvider = result;
}
<< Home