Event Information

This topic explains how to use CpExtra information variables to read information about an event which is currently being dispatched.

The xcmndAddEventListener command variable allows you to call actions when a certain event happens, such as clicking on a slide object (note: An action called by an event listener will be called an event handler for the rest of this article). However, it is possible to add event listeners to multiple objects but call the event handler. Under those circumstances it is useful if the event handler read information about what event caused it to be run.

NOTE: It is considered best practice at the start of an event handler to save these information variables value's separate user variables.This is because it is possible that the event handler's script could cause another event to be dispatched, which would change the values written inside of these information variables, which could cause unexpected behavior in the event handler's code.


Value type: Slide object (or possibly variable) name.

xinfoEventTarget tells you what object caused the event handler to be dispatched.

For example, lets say you had two objects on slide: Smart_Shape_1 and Smart_Shape_2. When clicking on either object you want them to be hidden. So using xcmndAddEventListener you add an event listener to Smart_Shape_1 and Smart_Shape_2, both calling the same event handler. Inside the event handler you want to hide the smart shape that was clicked. However, there are two smart shapes which could have been clicked. By reading the value inside of xinfoEventTarget you can detect whether it was Smart_Shape_1 which was clicked or Smart_Shape_2 which was clicked and then react accordingly (perhaps the most efficient way being directly assigning xinfoEventTarget to xcmndHide)

At the time of writing, only slide objects can dispatch events. But it is possible at a later time you could add event listeners to variables or the project itself. Under those circumstances xinfoEventTarget will correctly inform you of what object it was that dispatched the event.


Join more than 2500 other Adobe Captivate users just like yourself and receive regular troubleshooting tips, illustrated tutorials, technical information, and creative solutions to real-world e-learning development issues. (See an example here.) Click the button below to join our community.  It's completely FREE!