3 Replies Latest reply on Jun 22, 2011 5:27 PM by John Hawkinson

    In Design Button menu

    tommy_boy56

      I have a four page document that I have created multiple buttons for. I created remote rollovers and have to show/hide buttons often. My problems are as followed:

       

      !. In the "Actions" drop down menu in the "Buttons" pallet, only three buttons from a list of about 40 are visible at a time. Is there any way to expand this view?

      2. Every time I create a new button it is placed at the end of the list. If I create a new button for the first page it is placed at the end of the list not with the other buttons on the first page. Is there any way to manipulate this list to be more organized.

       

      Thank You in advance.

       

      Tom

        • 1. Re: In Design Button menu
          John Hawkinson Level 5

          As should be clear from your feature request post (Buttons visibility window), no, the answer is No.

           

          Anyhow, I asked you for more details there and you said:

          I have a 4 page document. Each page has about 10-15 images on the left side of the page. When the user rolls over each of these images, a text box associated with the image appears on the right side of the page. Both the images and text boxes are buttons. In order to have only one text box appear at a time I have to hide all of the other "Text" box buttons in the entire document. I have to turn off their visibility in both the "roll on" and "roll off" states. This can take quite some time seeing how I can only see 3 buttons in the "visibility" window.

           

          A screenshot probably would make this more clear.

           

          This simple script creates an array of all buttons (buttons), and then iterates over it. For each button, iterate over the behaviors and check to see if the current one is a MOUSE_ENTER or a MOSUE_EXIT (rollover or roll off). If so, set the fields to hide to all buttons.

           

          var i, j, e,
            buttons=app.activeDocument.buttons.everyItem().getElements();
          for (i=0; i<buttons.length; i++) {
            for (j=0; j<buttons[i].behaviors.length; j++) {
              e = buttons[i].behaviors[j].behaviorEvent;
              if (e === BehaviorEvents.MOUSE_ENTER ||
                e === BehaviorEvents.MOUSE_EXIT) {
                  buttons[i].behaviors[j].fieldsToHide = buttons;
              }
            }
          }
          

           

          That sounds ike it's almost what you want, except instead of "all buttons" you probably want to hide "all other buttons." In that case,

          you could use

           

          var allothers = buttons;
          allothers.splice(i,1);
          

           

          inside the iff, and then set fieldsToHide to allothers.

          • 2. Re: In Design Button menu
            tommy_boy56 Level 1

            Thanks for your reply, however not "all buttons" can be set to "hide". The "image" buttons have to be kept visible at all times only the "Text box" buttons have to be marked as visible or non visible. I am sure having a different naming scheme would help make the scripting easier.pallet.jpg

             

            As you can see from the screen shot some buttons are named "text" and some are not. The buttons that are just numbers have to be visible all of the time. Let me know if this helps.

             

            Tom

            • 3. Re: In Design Button menu
              John Hawkinson Level 5

              Well, you may need to customize it somewhat.

               

              It is not clear from your words whether you need to script to operate only on the Text buttons, or to operate on all buttons but show/hide the visibility of only the Text buttons, or some other case.

               

              If you'd like someone else to write the script for you, you need to be precisely clear on exactly what needs to happen to what set of objects. Be specific. Be too specific.

               

              Anyhow, one easy answer might be to put all the buttons you cared about in a layer.

              Then at the top of  the for (i) loop, you could use

               

                if (buttons[i].itemLayer.name !== "magic layer") { continue; }

               

              Then the script would only change the fieldsToHide of the buttons that were on the layer named "magic layer."

               

              Hundreds of ways to skin the cat, though.