Skip to main content
All CollectionsInteractions
Creating Interactions With Events
Creating Interactions With Events
Updated over 3 months ago

Events help create interactions outside of scope. 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. If the Events Panel is not visible, you can toggle it on with the Events button or use the keyboard shortcut OPT + 5.

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 on the Custom Event trigger, the Set Event action, or through the Events Panel.

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

Using an Event

Custom Event Trigger

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

Set Event Action

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

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 a Custom Event 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?