Hi everyone!
I’m trying to get a specific parent from a child. First, I get the parent into a DisplayObjectContainer:
var container:DisplayObjectContainer = child.parent;
Then, I want to check if the class’ name of this parent is “Level”, so I want to do something like this:
while (container.name != Level) {
container = container.parent;
}
Obviously, this doesn’t work or else I wouldn’t be writing here!
And if I do trace(container)
, it gives me [object Hero]
which is inside “Level”.
Is there a way to compare a DisplayObjectContainer
with… maybe a String?
Thank you!