Search the web
Sign In
New User? Sign Up
cairngorm-documentation · Cairngorm Documentation Group
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Show off your group to the world. Share a photo of your group with us.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Cannot assign arraycollection[i] value to VO variable due to ObjectP   Message List  
Reply | Forward Message #1015 of 1038 |
Re: Cannot assign arraycollection[i] value to VO variable due to ObjectProxy

Well, I think I have everything done correctly ... in my AS VO I have
the following:

[RemoteClass(alias="com.myproject.vo.ContactVO")]

And in my Zend AMF index.php I have ...

$server->setClassMap("com.myproject.vo.ContactVO", "ContactVO");

Again this all worked prior to refactoring to use Cairngorm -- not
sure what other classpath I would need to set?

Thanks!!

--- In cairngorm-documentation@yahoogroups.com, "Evan Gifford"
<evan@...> wrote:
>
> In that case you might need to just update the classpath in your
RemoteClass
> metadata.
>
> _____
>
> 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
> <mailto:cairngorm-documentation%40yahoogroups.com> tion@yahoogroups.com,
> "Evan Gifford"
> <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.getClassByAlias method to identify this structure as a
native
> > 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.registerClassAlias()
> > <http://livedocs.
> <http://livedocs.adobe.com/flex/2/langref/flash/net/package.html>
> adobe.com/flex/2/langref/flash/net/package.html>
> method.
> >
> > Flex has a handy metadata way to mark this up; like
> > [RemoteClass(alias="com.my.project.vo.ContactVO")]. Just put that
> above your
> > Class declaration and the Flex preprocessor will convert that into a
> > registerClassAlias() call for you.
> >
> > 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-documentation%40yahoogroups.com> tion@yahoogroups.com
> > [mailto:cairngorm-documenta
> <mailto:cairngorm-documentation%40yahoogroups.com>
tion@yahoogroups.com] On
> Behalf Of
> jeremysavoy
> > Sent: Friday, January 02, 2009 2:59 PM
> > To: cairngorm-documenta
<mailto:cairngorm-documentation%40yahoogroups.com>
> tion@yahoogroups.com
> > Subject: [cairngorm-documentation] Re: Cannot assign
arraycollection[i]
> > value to VO variable due to ObjectProxy
> >
> >
> >
> > I forgot to add, here is how I'm creating the AC:
> >
> > __model.myAC = new ArrayCollection(myDataGrid.dataProvider.source);
> >
> > --- In cairngorm-documenta
> > <mailto:cairngorm-documentation%40yahoogroups.com> tion@yahoogroups.
> <mailto:tion%40yahoogroups.com> com,
> > "jeremysavoy"
> > <jeremysavoy@> wrote:
> > >
> > > 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.
>
<http://livedocs.adobe.com/flex/2/langref/flash/events/IEventDispatcher.html
> > adobe.com/flex/2/langref/flash/events/IEventDispatcher.html
> > > adobe.com/flex/2/langref/flash/events/IEventDispatcher.html
> > >
> > > 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.length, i++){
> > > if (__model.myAC[i].Contact_ID == this.Contact_ID) {
> > > __model.contact = __model.myAC[i];
> > > }
> > > }
> > >
> > > 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::ObjectProxy@10eee479 to com.myproject.vo.ContactVO
> > >
> > > If I assign each individual field from __model.myAC[i].* to
> > > __model.contact.*, one at a time, then that works - but is
undesirable
> > > 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[i] as ContactVO;
> > >
> >
>





Sat Jan 3, 2009 5:55 pm

jeremysavoy
Online Now Online Now
Send Email Send Email

Forward
Message #1015 of 1038 |
Expand Messages Author Sort by Date

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...
jeremysavoy
Online Now Send Email
Jan 2, 2009
10:52 pm

I forgot to add, here is how I'm creating the AC: __model.myAC = new ArrayCollection(myDataGrid.dataProvider.source); ... ...
jeremysavoy
Online Now Send Email
Jan 2, 2009
10:59 pm

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...
Evan Gifford
evangifford
Offline Send Email
Jan 3, 2009
12:21 pm

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...
jeremysavoy
Online Now Send Email
Jan 3, 2009
2:51 pm

In that case you might need to just update the classpath in your RemoteClass metadata. _____ From: cairngorm-documentation@yahoogroups.com ...
Evan Gifford
evangifford
Offline Send Email
Jan 3, 2009
2:56 pm

Well, I think I have everything done correctly ... in my AS VO I have the following: [RemoteClass(alias="com.myproject.vo.ContactVO")] And in my Zend AMF...
jeremysavoy
Online Now Send Email
Jan 3, 2009
5:55 pm

BTW, the "object" field inside the "ObjectProxy" items is of type com.myproject.vo.ContactVO ... so things *seem* to be ok there, right? ... RemoteClass ... ...
jeremysavoy
Online Now Send Email
Jan 3, 2009
5:57 pm

I forgot to add, here is how I'm creating the AC: __model.myAC = new ArrayCollection(myDataGrid.dataProvider.source); ... ...
jeremysavoy
Online Now Send Email
Jan 3, 2009
2:43 pm

Evan you were right, there was an issue with my RemoteAlias ... I was using my fully qualified reverse DNS name for the VO, when I should have been using the...
jeremysavoy
Online Now
Jan 4, 2009
3:46 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help