actionscript 3 - Easy way to get list of ancestor Classes for the object in Action Script 3? -


i check if object has displayobject 1 of it's ancestors , perform operations on if has. quick , easy way this?

if "ancestor" mean "one of superclasses", solution simple: in actionscript object can have "a displayobject 1 of it's ancestors" if object's class has displayobject in it's inheritance chain, checked casting. inheritance creates "is a" relation between parent , child classes, child's instance instance of parent (and of other distant ancestor).

var object:* = ....; if (object displayobject) {     var displayobject:displayobject = object displayobject;     // object has displayobject class in it's inheritance chain     // object using displayobject reference }  

or

var object:* = ....; var displayobject:displayobject = object displayobject; if (displayobject != null) {     // object has displayobject class in it's inheritance chain     // object using displayobject reference }  

Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -