2 Replies Latest reply on Sep 10, 2013 5:53 AM by justrome0

    How to add a listener for a TextFrame BEFORE_PLACE / AFTER_PLACE events?

    justrome0 Level 1

      Using Creative Suite Extension Builder 2.0 I'm trying to automate some behavior once a text frame is created, or once a text frame is linked to a xml element. I'm not able to add the event listener though.

       

       

      The documentation states that there is a BEFORE_PLACE and a AFTER_PLACE event on the text frame... these events bubble. I tried listening on events using IDScriptingEventAdapter by adding global listeners and listeners on the application or document like this:

       

       

          IDScriptingEventAdapter.getInstance().addEventListener("afterPlace", handler);

          IDScriptingEventAdapter.getInstance().addEventListener("beforePlace", handler);

         

          IDScriptingEventAdapter.getInstance().addEventListenerToObject("afterPlace", handler, document);

          IDScriptingEventAdapter.getInstance().addEventListenerToObject("beforePlace", handler,document);

       

       

      The handler is not called when I create a text frame.

      Anyone knows what I'm doing wrong?