1 Reply Latest reply on Sep 12, 2007 12:34 PM by Daniel_Summers

    Nested Remoted Objects

    Daniel_Summers
      When using Remote Objects, I'm successfully using AMF to transfer PHP Objects.

      I have an ArrayCollection that forces the "com.gh.vo.ContactMainViewVO" type - Works great.

      My problem is when I try go another level deeper and type an array inside of that object, it only types it as an object and not the [ArrayElementType("com.gh.vo.ContactPhoneNumber")].

      Is it possible to do this?


      ----------------------------------------------------

      [Bindable]
      [ArrayElementType("com.gh.vo.ContactMainViewVO")]
      private var _contactsMainView:ArrayCollection;

      ----------------------------------------------------

      package com.gh.vo {

      import com.gh.vo.*;
      import flash.net.registerClassAlias;
      import mx.collections.ArrayCollection;

      [RemoteClass(alias="ContactMainViewVO")]
      [Bindable]
      public class ContactMainViewVO {

      public var contactId:int;
      public var firstName:String;
      public var lastName:String;
      public var title:String;
      public var companyName:String;
      public var emailAddress:String;

      [ArrayElementType("com.gh.vo.ContactPhoneNumber")]
      public var phoneNumbers:Array;

      }
      }

      --------------------------------------------------------------

      package com.gh.vo {

      import com.gh.vo.*;
      import flash.net.registerClassAlias;

      [RemoteClass(alias="ContactPhoneNumberVO")]
      [Bindable]
      public class ContactPhoneNumberVO {

      public var contactPhoneNubmerId:int;
      public var contactId:int;
      public var phoneNumer:String;
      public var phoneNumberType:String;
      public var primaryNumber:int;

      }
      }
        • 1. Re: Nested Remoted Objects
          Daniel_Summers Level 1
          UPDATE:

          I've worked around the problem by using the following (after correcting some spelling errors *nubmer):

          ------------------------------------------------------------

          /*
          [ArrayElementType("com.gh.vo.ContactPhoneNumber")]
          public var phoneNumbers:Array;
          */

          [ArrayElementType("com.gh.vo.ContactPhoneNumber")]
          private var _phoneNumbers:ArrayCollection;

          public function get phoneNumbers():ArrayCollection {
          return _phoneNumbers;
          }

          public function set phoneNumbers( phoneNumbers:* ):void {
          var ac:ArrayCollection = new ArrayCollection();
          for each( var pNum:ContactPhoneNumberVO in phoneNumbers ) {
          ac.addItem( pNum );
          }
          _phoneNumbers = ac;
          }



          ------------------------------------------------------------