I put together a sample that shows this not working correctly http://www.cubicleman.com/arraytest.zip seems the array of address objects does get returned to Flex from CF, but the debugger is showing that the elements are plain objects only, not a addreess object.
Seems something is wrong with my returntype on my CFC maybe? What should the returntpye be set to when returning a array of CFCs? I am using returntype="address[]" DK On 6/22/06, Douglas Knudsen <[EMAIL PROTECTED]> wrote: > That would be a bit of code to share! I'm using Cairngorm. The AS > class customer below is stored in the modellocator and in my test > cases that are failing, no value is changed in the customer object at > all. In fact I only bind one value to a view just to ensure the > object is getting retrieved. > > DK > > On 6/22/06, João Fernandes <[EMAIL PROTECTED]> wrote: > > > > Doug, > > > > can you share your mxml code? > > Did you assign your as classes to any variable? > > > > > > João Fernandes > > > > -----Original Message----- > > From: [email protected] on behalf of Douglas Knudsen > > Sent: Thu 22-Jun-06 3:05 AM > > To: [email protected] > > Subject: [flexcoders] array of CFCs and RemoteObject FB2B3 > > > > Ok, having some struggles here with ColdFusion CFCs, related AS VOs, > > and remoteobject. > > Say I have a CFC called Customer.cfc which is bean styled. It has a > > property Addresses which is a array of Address.cfc also bean styled. > > Similarly I have ActionScript VOs setup and registered to map to the > > CFCs. Ok, I build a Flex app that retrieves a Customer object. It > > gets mapped over to AS ok, I can see the array of Address objects and > > see they are typed correctly. Now I call a method via RemoteObject > > called save() passing the Customer object to this method. Bomb! When > > the AS array of objects is passed to CF it loses its type. Below I > > have some code example of what things look like. > > > > Thoughts? > > > > Customer.cfc > > <cfcomponent> > > <cfproperty name="customerId" type="numeric" default="0" /> > > <cfproperty name="addresses" type="address[]" /> > > > > <cfscript> > > variables.customerId= 0; > > variables.address = ArrayNew(1); > > </cfscript> > > > > <cffunction name="getCustomerId" output="false" access="public" > > returntype="numeric"> > > <cfreturn variables.customerId> > > </cffunction> > > > > <cffunction name="setCustomerId" output="false" access="public" > > returntype="void"> > > <cfargument name="val" required="true"> > > <cfset variables.customerId = arguments.val> > > </cffunction> > > > > <cffunction name="getAddress" output="false" access="public" > > returntype="address[]"> > > <cfreturn variables.address > > > </cffunction> > > > > <cffunction name="setAddress" output="false" access="public" > > returntype="void"> > > <cfargument name="val" required="true" type="address[]" > > > <cfset variables.address = arguments.val> > > </cffunction> > > > > </cfcomponent> > > > > address.cfc > > <cfcomponent > > > <cfproperty name="addressId" type="numeric" default="0"> > > <cfproperty name="address1" type="string" default=""> > > <cfproperty name="city" type="string" default=""> > > <cfproperty name="state" type="string" default=""> > > <cfproperty name="zip" type="string" default=""> > > > > <cfscript> > > //Initialize the CFC with the default properties values. > > variables.addressId = 0; > > variables.address1 = ""; > > variables.city = ""; > > variables.state = ""; > > variables.zip = ""; > > </cfscript> > > > > <cffunction name="init" output="false" returntype="address"> > > <cfreturn this> > > </cffunction> > > <cffunction name="getAddressId" output="false" access="public" > > returntype="any"> > > <cfreturn variables.AddressId> > > </cffunction> > > > > <cffunction name="setAddressId" output="false" access="public" > > returntype="void"> > > <cfargument name="val" required="true"> > > <cfif (IsNumeric(arguments.val)) OR (arguments.val EQ "")> > > <cfset variables.AddressId = arguments.val> > > <cfelse> > > <cfthrow message="'#arguments.val#' is not a valid > > numeric"/> > > </cfif> > > </cffunction> > > > > <cffunction name="getAddress1" output="false" access="public" > > returntype="any"> > > <cfreturn variables.Address1> > > </cffunction> > > > > <cffunction name="setAddress1" output="false" access="public" > > returntype="void"> > > <cfargument name="val" required="true"> > > <cfset variables.Address1 = arguments.val> > > </cffunction> > > > > <cffunction name="getCity" output="false" access="public" > > returntype="any"> > > <cfreturn variables.City> > > </cffunction> > > > > <cffunction name="setCity" output="false" access="public" > > returntype="void"> > > <cfargument name="val" required="true"> > > <cfset variables.City = arguments.val> > > </cffunction> > > > > <cffunction name="getState" output="false" access="public" > > returntype="any"> > > <cfreturn variables.State> > > </cffunction> > > > > <cffunction name="setState" output="false" access="public" > > returntype="void"> > > <cfargument name="val" required="true"> > > <cfset variables.State = arguments.val> > > </cffunction> > > > > <cffunction name="getZip" output="false" access="public" > > returntype="any"> > > <cfreturn variables.Zip> > > </cffunction> > > > > <cffunction name="setZip" output="false" access="public" > > returntype="void"> > > <cfargument name="val" required="true"> > > <cfset variables.Zip = arguments.val> > > </cffunction> > > > > > > </cfcomponent> > > > > customer.as > > package customer > > { > > [RemoteClass(alias="customer")] > > > > [Bindable] > > public dynamic class customer > > { > > > > public var customerId:Number = 0; > > public var address:Array; > > > > public function custumer() > > { > > } > > > > } > > } > > > > address.as > > package address > > { > > [RemoteClass(alias="address")] > > > > [Bindable] > > public dynamic class address > > { > > > > public var addressId:Number = 0; > > public var address1:String = ""; > > public var city:String = ""; > > public var state:String = ""; > > public var zip:String = ""; > > > > public function address() > > { > > } > > > > } > > } > > > > > > -- > > Douglas Knudsen > > http://www.cubicleman.com > > this is my signature, like it? > > > > > > > > > > -- > > Flexcoders Mailing List > > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt > > Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com > > Yahoo! Groups Links > > > > > > > > > > > > > > > -- > Douglas Knudsen > http://www.cubicleman.com > this is my signature, like it? > -- Douglas Knudsen http://www.cubicleman.com this is my signature, like it? ------------------------ Yahoo! Groups Sponsor --------------------~--> Something is new at Yahoo! Groups. Check out the enhanced email design. http://us.click.yahoo.com/SISQkA/gOaOAA/yQLSAA/nhFolB/TM --------------------------------------------------------------------~-> -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

