var numParents:int = 0; for(var i:* = this.parent;i!=null;i = i.parent){ numParents++; } trace("I have "+numParents+" ancestors");