@Rob – what do you want exactly to achieve with the function myListener?
As you might know, you can add behaviors like gotoURLBehaviors to a button and can assign behaviorEvents like BehaviorEvents.MOUSE_UP.
Adding an event listener like you wanted to do is for ScriptUI elements.* Not for Button objects on the page.
The only specific events a event listener for a specific Button object (pageItem class) can directly listen to are AFTER_PLACE and BEFORE_PLACE.
Of course there are other events you can listen to, if you add an event listener to the app object, but you have to filter out a specific button (or all buttons), if you want to react for events like AFTER_CONTEXT_CHANGED or AFTER_SELECTION_CHANGED.
Unfortunately events like "mouseup" are not available for pageItems.
And another thing:
Your variable myButton is of type String. It's the name of a button. Not the button!
Thanks Laubnder and you're right, myButton is type of string. I was actually writing it to the console and forgot to get rid of name. I have a project that consists of a schematic and buttons that when exported to Acrobat give a toolip and hide/show layers on click. In Indesign I have a UI window for programming the buttons.
The way I have it now, my Ui window stays open all the time. When I click on a button on the Indesign page, I have an "update" button on the UI window that sets the UI window textfields to the data for the newly selected button on the Indesign page. What I'm trying to accomplish with the eventlistener is to automatically update the UI window with the new selected button information. It sounds like I may be able to use AFTER_SELECTION_CHANGED.
Thanks for the response.