From: Tarun R E. <ta...@we...> - 2000-10-30 22:04:18
|
I too was suprised that getParentComponent() wasnt working ( I just bothered to check now). However when I had a look at 'core.api.dynlayer.js', the reason wasnt too suprising. The method getParentComponent() returns the property 'this.parentComponent', however this property doesnt seem to be set anywhere, and so remains undefined. To get around the problem simply access the parent property of the DynLayer. for example : // Assuming myLayer has been defined and added as a child of myParentLayer somewhere myLayer.parent // gives parent object // To check whether the child layer belongs to a specific parent, you can do this if (myLayer.parent == myParentLayer) { } // Alternatively you can define and set the "id" property of all the parent layers like : myParentLayer.id = "Pa"; if (myLayer.parent.id == "Pa") // The second method might be preferable, when you have multiple references to the same layer // or when you have both DynLayers and inline layers present, and you want the code that accesses // them to be the same. ----- Original Message ----- From: "Matthew" <ma...@di...> To: <dyn...@li...> Sent: Monday, October 30, 2000 11:48 PM Subject: [Dynapi-Help] child is nested in a parent > What I am wanting to do is check if a child exists within a parent layer.. I > have been looking at the children array and understand that a child exists > when it is found in this array.. but what I am wanting to do is check > weather a child is within a specific parent layer and if so manipulate that > child... and visa versa.. if it doesn't exist within that parent layer then > manipulate it.. so what I found was the function called .getParentComponent > which I am assuming does what I am wanting.. but I am not sure how to call > this.. I am doing mychild.getParentComponent when the child is on a parent > layer, this returns UNDEFINED.. > > So any help would be much appreciated.. I am assuming that I use the array > but how do I make sure that I am referencing the correct child when there > are multiple parents with children... > > Cheers Matt > > _______________________________________________ > Dynapi-Help mailing list > Dyn...@li... > http://lists.sourceforge.net/mailman/listinfo/dynapi-help > |