2 Replies Latest reply on Nov 22, 2010 8:05 AM by PeterPow

    Prototyping

    PeterPow Level 1

      Hello guys,

       

      I would like to prototype some objects and run into questions. Take a look at the following code snippet:

       

      PageItem.prototype.DoPageItem = function(){

        app.consoleout('do pageitem');

      }

       

      TextFrame.prototype.DoTextFrame = function(){

        app.consoleout('do textframe');

      }

       

      Is it possible for the textframe to inherit the prototype object of the page item? In standard javascript I would do something like

       

      TextFrame.prototype = new PageItem();

       

      but this doesn't work in InDesign as the PageItem-object does not have a constructor, is there another way for doing this?

      Thanks in advance!

        • 1. Re: Prototyping
          Harbs. Level 6

          No. The native object inheritance is not something you can work with yourself.

           

          It is possible to prototype native InDesign objects, but only parts of the objects. You have to steer far away from any native functionality.

           

          For the most part, I find prototyping InDesign objects not worth the effort...

           

          Just make general helper functions with the object as one of the arguments...

           

          Harbs

          • 2. Re: Prototyping
            PeterPow Level 1

            Thanks for the info.