Getting name from object in JS

Problem:

I run some JS code as an event triggered by clicking on an object called ‘square’.
In the JS code I want to work with the name of that object. I tried to assign ‘name()’, ‘object.name()’ and ‘prez.object.name()’ to a variable, but neither worked. ‘prez.name()’ gave me the name of the project, as expected. Where is the mistake?
Thanks for your help,

Rolf

ActivePresenter Version: 8

OS: Win10

Notes:

Hi Rolf,

Please use this.name() to get the current object name. You should place this code in the event of the object.

In addition, in any JavaScript action, you can use the following variables:

  • this : the current target object that handles the event.
  • e : the event object. It may provide some useful information for some events. For example, e.value in a On Accept event is the drag source that is dropped.
  • prez : the presentation.
  • AP : the player.

Regards,

Thanks, Nam.

Best, Rolf