Home > Adobe, ColdFusion, Flex > How to Improve Flex data transfer from CF?

How to Improve Flex data transfer from CF?

I found this article and realised that transferring data from CF (CFC objects) to Flex application using this way will reduce the packet size and improve the performance.

You don’t need to create an object of the CFC type you want to send data across in your array, but what you need to do is take following steps and you can improve your application’s performance:

Following code is how I used to send data across to my Flex App:

<cfloop query=”myQuery”>


local.result = createObject(“component”,”com.philip.myproj.myobj”);



arrayAppend(local.results, local.result);



The above method is how most of the developers use and it works fine only downside is this passes the complete object with all setter’s and getter’s and makes it bulky.

The following method is very light weight to pass the objects around and its documented in here: Writing the ColdFusion CFCs

you just need to change the object creation step with creating a simple Struct and you need to add an extra line to declare its a type of following CFC Value object likt this:

local.result[“__type__”] =”com.philip.myproj.myobj”;

Here is how you write the code using above type declaration:

<cfloop query=”myQuery”>


local.result = structNew();

local.result[“__type__”] = “com.philip.myproj.myobj”;

local.result[“prop1”] = myQuery.val1;

local.result[“prop2”] = myQuery.val2;

arrayAppend(local.results, local.result);



And Flax / Flash is sharp enough to pick this up and automatically link with ActionsScript VO class and you will get typed data.

Categories: Adobe, ColdFusion, Flex
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: