From: cairngorm-documentation@yahoogroups.com [mailto:cairngorm-documentation@yahoogroups.com] On Behalf Of jeremysavoy
Sent: Saturday, January 03, 2009 6:51 AM
To: cairngorm-documentation@yahoogroups.com
Subject: [cairngorm-documentation] Re: Cannot assign arraycollection[i] value to VO variable due to ObjectProxy
Thanks for the response. I actually already have this code in all of
my VO's - and in fact this code was working without any issue prior to
refactoring to use Cairngorm.
--- In cairngorm-documenta
<evan@...> wrote:
>
> I've encountered this many times, it is caused by Flash not able to
make the
> connection with class information in the AMF or missing class
information.
>
> By default, AMF will only encode the binary equivelent of an XML
file. Just
> for fun, try writing that ObjectProxy out to the hard drive and open
it up
> with a text editor to see for yourself. Flash will try to the
> flash.net.getClassB
> Class. If that method does not return a Class, it will default to using
> ObjectProxy because it doesn't have any way to make the connection
to the VO
> on the client side.
>
> The way to make the connection is to use the
flash.net.registerC
> <http://livedocs.
method.
>
> Flex has a handy metadata way to mark this up; like
> [RemoteClass(
above your
> Class declaration and the Flex preprocessor will convert that into a
> registerClassAlias(
>
> You'll need the above line for every VO you'll be recieveing in the
form of
> AMF - that includes Local Shared Objects and if you use ByteArray to
> deep-copy an object.
>
> -Evan
>
> _____
>
> From: cairngorm-documenta
> [mailto:cairngorm-documenta
jeremysavoy
> Sent: Friday, January 02, 2009 2:59 PM
> To: cairngorm-documenta
> Subject: [cairngorm-document
> value to VO variable due to ObjectProxy
>
>
>
> I forgot to add, here is how I'm creating the AC:
>
> __model.myAC = new ArrayCollection(
>
> --- In cairngorm-documenta
> <mailto:cairngorm-
> "jeremysavoy"
> <jeremysavoy@
> >
> > I have an array collection that is a collection of ContactVO items.
> > When I debug and look at the ArrayCollection, each item, [0], [1], etc
> > is of type ObjectProxy, and insed each of these there is an "object"
> > that then contains the ContactVO fields. I'm assuming they are
> > ObjectProxy because I implemented the fix outlined at the bottom of
> > this page:
> >
> >
> http://livedocs.
>
<http://livedocs.
> > adobe.com/flex/
> >
> > The problem, is that when I try to assign a ContactVO directly to an
> > item in the ArrayCollection, as here:
> >
> > for (var i:int = 0, i < __model.myAC.
> > if (__model.myAC[
> > __model.contact = __model.myAC[
> > }
> > }
> >
> > I then get the following error on the assignment line number (last
> > line of code above).
> >
> > TypeError: Error #1034: Type Coercion failed: cannot convert
> > mx.utils::ObjectPro
> >
> > If I assign each individual field from __model.myAC[
> > __model.contact.
> > and extra work - I suppose I would just implement a function to do
this.
> >
> > Is there any better solution? I have tried the following but got a
> > similar but maybe different error:
> >
> > __model.contact = __model.myAC[
> >
>