javascript - isPrototypeOf in indesign -


hi relativly new indesign scripting , figure out if object subtype of class. example: want iterate on page items , take not graphic:

layer = app.activedocument.layers[layerindex];  (i = 0; < layer.allpageitems.length; i++) {   alert(layer.allpageitems[i].reflect.name)   if(layer.allpageitems[i].isprototypeof (graphic) ) {     alert("graphic");   } else {     ....   } } 

howver if nver matches. there examples of how use isprototypeof? have test if object of type or subclass of it?

edit: clarify, trying test if have instance of inherited graphic.

but far can see seems impossible.

you want instanceof operator.

if (layer.allpageitems[i] instanceof graphic) {     alert("graphic"); } else {     .... } 

you use isprototypeof have reverse order , prototype itself, not constructor. this:

if (graphic.prototype.isprototypeof(layer.allpageitems[i])) {     alert("graphic"); } else {     .... } 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -