3 Replies Latest reply on Oct 22, 2010 7:12 AM by try67

    Layer scripting

    Mar.ko Level 1

      Hi All,

       

      I have a pdf which is pretty much a guide. I created InDesign file with layers and exported as pdf. 

       

      I'm trying to do the following:

       

      When user hit one of the navigation links, a layer associated with that link shows up. In layer that showed up, i have more links associated with images in stand alone layers. Everything works like i want.

       

      The problem is that links in non active layers work behind the scene when i hover over.

       

      Is there a way to solve this problem?

       

      The script (in link action) i'm using to show/hide layers is:

       

      var ocgs = this.getOCGs();
      for (var i=0; i<ocgs.length; i++)
      if (ocgs[i].name == "LayerName")
      ocgs[i].state = ocgs[i].state=true;

       

      var ocgs = this.getOCGs();
      for (var i=0; i<ocgs.length; i++)
      if (ocgs[i].name == "LayerName")
      ocgs[i].state = ocgs[i].state=false;

       

      I'm using Acrobat 9 pro

       

      Please help

       

      Thanks in advance

        • 1. Re: Layer scripting
          try67 MVP & Adobe Community Professional

          The last line of each block is not correct.

          It needs to be:

           

          ocgs[i].state = true;

           

          and

           

          ocgs[i].state=false;

          1 person found this helpful
          • 2. Re: Layer scripting
            Mar.ko Level 1

            Hi,

             

            Thanks for the answer!

             

            Do you know how to make link readOnly? When i hit the link, the layer becomes visible and that link becomes readOnly at the same time.

             

            Thanks

            • 3. Re: Layer scripting
              try67 MVP & Adobe Community Professional

              I don't think a link has such property. Anyway, not one that you can set

              with a script.

              Are you sure it's not covered by something else?

               

              Come to think of it, you probably are using a form field button, not a

              "real" link. If so, it has a boolean property called readonly which you can

              set yourself.