Hi guys,

Was wondering if anyone faced this problem and what are the possible
workarounds..

I have been experimenting with Flex Data Services and ended up with a small
prototype where I have a list of users and each user can have several
addresses. 
Please  see  AS Classes below.
Visually it looks like 2 datagrids - the first one shows user, and once a
user is selected its address become visible in the second datagrid.

Well in general it works great, however I seem to have to explicitly cast 
each item of addressList to an instance of  Address class before sending to
the server (otherwise they will come as instances of ASObject class),
although I'm prettry sure they come ok from Java side... 

private function getAddresses():Array{
        var aList:ICollectionView = ICollectionView(addrList);
        var cursor:IViewCursor = aList.getCursor();
        var arr:Array = new Array();
        while (!cursor.afterLast)
        {
           arr.push(Address(cursor.current));
           cursor.moveNext();
         }
  return arr;
}

However I'd expect AS to maintain the correct class instance?

------------ AS Classes ------------------------
package samples.user {

    import mx.data.IManaged;
    import mx.data.utils.Managed;
    import mx.core.mx_internal;
    import mx.collections.ArrayCollection;
    import mx.utils.ObjectUtil;
    
    [Managed]
        [RemoteClass(alias="samples.user.User")]
        public class User {
                public var id:int;
            public var firstName:String ;
            public var lastName:String ;
        public var email:String ;
        public var addressList:Array;                      //  it is mapped
as " public Set addressList; "     on Java side
        }
}



package samples.user {
    import mx.data.IManaged;
    import mx.data.utils.Managed;
    import mx.core.mx_internal;
    import mx.collections.ArrayCollection;
    import samples.user.User;
    
    [Managed]
        [RemoteClass(alias="samples.user.Address")]
        public class Address {
                public var id:int;
                public var street:String;
                public var houseNum:int;
                public var zip:String;
                public var user:User;
        }
}


Many thanks in advance,
Alex






--
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/
 


Reply via email to