Skip to main content
All CollectionsInteractions
Creating Interactions With Events
Creating Interactions With Events
Updated over a week ago

Event Listener triggers and Set Event actions help create other interactions across pages, modals, and navigation bars. They act as the middleman for an initial trigger and a resulting action.

What is an Event

An "event" is a construct in Play. It's not an element, and there's nothing physically created. It's a construct, defined by you for a specific purpose.

You'll find a list of your events in the Events Panel, which can be found in the left panels in Interaction Mode. You can rename an event or edit its description by clicking on the event in the Events Panel. You can delete or duplicate the event by right-clicking on it.

Creating an Event

You can create an event in three ways: on the Event Listener trigger, on the Set Event action, or in the Events Panel.

You'll define the event with a name and description, which we recommend relating to the resulting action.

Using an Event

Set Event Action

Set Event actions are added to any trigger, and when that trigger fires, the event occurs.

Event Listener Trigger

Event Listener triggers listen for a specific event to happen. You can choose the event to listen for. When the event occurs, the Event Listener triggers its own set of resulting actions.

When to Use Events

So what is the point of events? Why not just use normal interactions?

Sometimes you'll want to trigger an interaction, but the target is out of scope. For example, you may want to change something on a page by interacting with something in a page loader. There is no way to target the page from the page loader, so events are necessary.

With events, you can fire a Set Event action on, for example, a button's Tap trigger within a page loader. You can add an Event Listener on the original page (not the page within the page loader) with a Set State action. Now, when a user taps the button on the page loader, your event interaction will fire the Set State action on the page.

Events in the Navigation Bar

Events are also handy for adding interaction to a navigation bar. You can assign an event to each of the bar items, so when a user taps one of them, the event will fire.

When an event is added to a nav bar item, Play automatically adds an Event Listener trigger to the page with the selected event as the event. You can then add whatever action you'd like.

Did this answer your question?