4 Replies Latest reply on Feb 6, 2007 3:20 PM by (Dave_Saunders)

    ActiveLayer

    Level 1
      What does the server use in lieu of an active layer? Say I suspect that one or more layers might be locked, but I know that the one containing myTextFrame is not locked.

      Can I nonetheless say:

      app.activeWindow.activeLayer = myTextFrame.itemLayer

      so I can confidently create a new text frame without having to worry about locked layers?

      Dave
        • 1. Re: ActiveLayer
          The server also recognizes layers but it doesn't have windows, so there is no 'activeWindow' property on the app object in the server. Unfortunately, there is no other way to change the active layer but through the window. An 'activeLayer' property does not exist on the document object. You can, however, scan through the layers on a document using the 'document.layers' property to unlock any of them.
          • 2. Re: ActiveLayer
            Level 1
            Thanks Tom,

            It happens that I found a completely different way of addressing the problem that caused me to post this message. I was thinking, had I stayed with plan A, that the way to go was to cycle through the layers noting their current setings, then unlocking them all, doing my thing, and then restoring the locks.

            Dave
            • 3. Re: ActiveLayer
              Level 1
              If it is useful you can easily keep this state within your JavaScript program by doing the following:

              var Layer activeLayer = myTextFrame.itemLayer;

              At some later point then you can use activeLayer.
              • 4. Re: ActiveLayer
                Level 1
                You know, Michael, that is so obvious that I'm left wondering where the heck my mind was earlier today.

                Thanks.

                Dave