Clear text from drop target by script without using object name

Hello all,
I’m trying to clear the text from a drop target by script.
I run the below line on “On Accept” and it works fine:
prez.object(“Drop Target_7”).text("");
But to re-use it easily on many drop targets I’m wondering if there is a way to do something like:
prez.object(this).text("");
prez.object(this.object).text("");
I tried both but it does not seem to work. Is there a way to get the object on which the “On Accept” is set without using the objects name?
Thanks,

Michael

Hi Michael,

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.

So to clear text from a drop target in its On Accept event, just use this.text('');.

Regards

Hi,
Thanks a lot - this is of course logical… I’m not sure why I didn’t try that.
Thanks!