Copy link to clipboard
Copied
hay all
im new at CF and i'm traying to pass an array (list of languages form mySql) aealy simple one, my function looks like that:
<cfcomponent>
<cffunction name="get_languages_pagingUtils" access="remote" returntype="Array" >
<cfset var arrResult = arrayNew( 1 ) >
<cfquery name="languages">
SELECT language_name,native_name
FROM languages
</cfquery>
<cfreturn arrResult>
</cffunction>
</cfcomponent>
on the as3 side i have this:
the function that call the old fusion function-
public static function getData():void
{
var nc:NetConnection;
nc = new NetConnection();
nc.connect("http://localhost:8500/flashservices/gateway/");
nc.call("paging-debug.cfc.pagingService.get_languages_pagingUtils", new Responder(onResult, onError));
}
and the result function:
public static function onResult(result:Array):void
{
trace("result = ", result as Array)
}
i have tray to find all kind of tutorials but no success there..
i'll be happy for sum halp
thanks..
Copy link to clipboard
Copied
This is not the best place to post this, but I hope this helps.
You can use a simple remote object for this.
index.mxml
<mx:RemoteObject
destination="ColdFusion"
source="paging-debug.cfc.pagingService.get_languages_pagingUtils"
endpoint="http://localhost:8500/flashservices/gateway/" (try this insead http://localhost:8500/flex2gateway/)
id="roLanguages"
showBusyCursor="true">
<mx:method name="get_languages_pagingUtils" result="onResult(event)" />
</mx:RemoteObject>
your actionscript
import mx.rpc.events.ResultEvent;
import mx.utils.ObjectUtil;
public function getData():void{
roLanguages.get_languages_pagingUtils()
}
private function onResult(event:ResultEvent):void{
trace(ObjectUtil.toString(event.result);
}
Copy link to clipboard
Copied
thanks for your answer..
i thought that it's not the place for it..
but any way this is steel not helping me cose im trying to pass the array to
a class and not to flex - (when i'm dooing it in flex its all good just like you say)
thanks again.