I would like to check if object has a DisplayObject as one of it’s ancestors and perform some operations on it if it has. Any quick and easy way to do this?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If by “ancestor” you mean “one of superclasses”, then the solution is simple: in ActionScript an object can have “a DisplayObject as one of it’s ancestors” only if object’s class has DisplayObject in it’s inheritance chain, which is easily checked by casting. Inheritance creates “IS A” relation between parent and child classes, so a child’s instance IS An instance of parent (and of any other distant ancestor).
or