generic parent object handling
[potlatch2.git] / net / systemeD / halcyon / connection / Relation.as
index 02fccdc005e5f24b17a3c281d3908af660b35be8..475a95ef00303cd7e33aa294dfad9287966055ab 100644 (file)
@@ -7,6 +7,7 @@ package net.systemeD.halcyon.connection {
         public function Relation(id:Number, version:uint, tags:Object, members:Array) {
             super(id, version, tags);
             this.members = members;
+                       for each (var member:RelationMember in members) { member.entity.addParent(this); }
         }
 
         public function get length():uint {
@@ -18,20 +19,24 @@ package net.systemeD.halcyon.connection {
         }
 
         public function setMember(index:uint, member:RelationMember):void {
-            members.splice(index, 1, member);
+                       member.entity.addParent(this);
+                       members.splice(index, 1, member);
         }
 
         public function insertMember(index:uint, member:RelationMember):void {
+                       member.entity.addParent(this);
             members.splice(index, 0, member);
         }
 
         public function appendMember(member:RelationMember):uint {
+                       member.entity.addParent(this);
             members.push(member);
             return members.length;
         }
 
         public function removeMember(index:uint):void {
-            members.splice(index, 1);
+            var removed:Array=members.splice(index, 1);
+                       removed[0].entity.removeParent(this);
         }
 
                public override function getType():String {