When you run a statechart, it becomes an actor: a running process that can receive messages, send messages and change its behavior based on the messages it receives, which can cause effects outside of the actor.
An invoked actor is an actor that can execute its own actions and communicate with the machine. These invoked actors are started in a state and stopped when the state is exited.
Invoked actors are are labeled on their invoking state with “Invoke /” followed by the actor’s source name and ID.
You can invoke multiple actors on a single state. Top-level final states cannot have invoked actors.
View this machine in the Stately Studio.
In the video player above, the startVideo actor is invoked when the video player is in the Opened state.
Invoke actors on a state
- Select the state you want to invoke an actor.
- Open the State details panel from the right tool menu.
- Use the + plus icon alongside the Invoked actors to add a new action.
- Add the source for the actor using the src text input.
- Add the ID for the actor using the ID text input.
- Save the invoked actor using the Save button.