hi i'm scripting adobe indesign via js. i've created custom 'classes' custom indesign objects. inherit common methods generic 'item' class. problem of these methods need acces arguments of child's constructor. know may sound convoluted, please refer example: /* generic object, containig common methods */ function item(){ this.geometricbounds = function(){ /*relies on this.item child object*/ alert(this.item.geometricbounds) } }
/* specific object, inheriting item() */ function box(item){ this.constructor = box; /* creates this.item ancestor can use in it's methods */ this.item = item; } box.prototype = new item(); // example of use = new box(app.selection[0]) a.geometricbounds() can see there workaround. i'm not entirely happy "this.item = item" in box()'s constructor. have repeat line in every constructor function inheriting item(). wonder wheter there's way make ancestor's method aware of child's variables. help weller | |
|  |
More discussions in InDesign Scripting
adobe
Comments
Post a Comment