5 Replies Latest reply on Jan 10, 2013 6:19 AM by KeithGilbert

    [IDCS6 JS] Cannot delete rectangle from a button

    KeithGilbert Level 1

      I'm creating a button with:


           var myRevealButton = myPage.buttons.add();


      This creates an "empty" button consisting of a small rectangle.


      Then I add some artwork (a group of InDesign objects) to the first state:




      But when I try to remove the small rectangle automatically created by myPage.buttons.add(), I'm unable to do so (Object is invalid).




      Am I doing something wrong, or is this a bug? The rectangle shows up clearly in the Layers panel, and is visible on-screen, and I can delete it normally, but not via scripting.


      On closer inspection,


           myRevealButton.states[0].rectangles.length = 0?


      Any ideas?