Receiving Flex Objects in Coldfusion, coldfusion component argument types

Flex Remoting with Coldfusion. Coldfusion Services and custom objects/components

I was getting frustrated when I COULD NOT receive a flex object as anything when a coldfusion service was receiving a remote call from flex. The coldfusion component had a method I was sending a call to. This method expected a struct arguement and then I was trying the argument type as on object. When I passed in the flex object to the remote method call in flex, when coldfusion received the argument it was breaking it apart and treating it as a messed up argument collection. Turns out you have to wrap a flex object in another object for coldfusion to receive it as a struct. Why the lack of documentation on this? I think flex remoting is really cool, but maybe it is a newer wave of development that just hasn’t been very popularized yet. I think that is changing.

In any case the following links really help with understanding how coldfusion and flex work together with remoting. Coldfusion components, like custom TO objects, can also be used across the wire, and vice-versa with flex objects. It is pretty slick, but you have to learn how to make coldfusion components and corresponding flex objects with properties that match, etc.

Nice article by Joel.

I had originally found the following, which was helpful:

For custom component types, see also:

Flex DataGrid rows. Does the selected item’s index in the dataprovider ArrayCollection change when the grid is re-sorted?


For example, if I have 4 rows displaying user info, if the first row’s user has a name of ‘Kato’, the dataproviderUserArrayCollection[0].name = “Kato”.

What happens when I resort the rows by userNumber (or something) and Kato’s row is the third row? Is the the index of Kato’s Object in the array collection 0 or 2? It’s 2.

The array shifts to match the datagrid’s visual display (factuality, I’m sure the data model itself changes before the visual rendering is response to a click on a column title). So if Kato’s row moved from first place to third, so did his dataprovider array position. dataproviderUserArrayCollection[0].name = “Kato” shifted to dataproviderUserArrayCollection[2].name = “Kato”.

Dynamic argument list with coldfusion methods using argumentCollection

Check out the link, and learn how to use pass arguments to Coldfusion methods using the argumentCollection as your parameter. This is slick.

I was doing the following, concatenating my argument list to change with logic. I should have been using an argument struct instead of a clumsy string that was being evaluated like this:

<!--- This is a not so cool approach--->
argsColl = "";
argsColl &= "username=Almonzo,";
argsColl &= "password="LauRa123";
authorized = securityCFC.getAuth(Evaluate(argsColl));

The following was so much cooler, cut my code down, and made it so I didn’t have to figure out why the Evaluate function won’t evaluate strings with commas:)

argsColl = structNew();
argsColl.username = "Almonzo";
argsColl.password = "LauRa123";
authorized = securityCFC.getAuth(argumentCollection = argsColl);

Helpful link: