Is it possible to run a sequence of actions when clicking a hotspot?

Ali87
Posts: 6
Joined: Mon Feb 20, 2017 1:01 pm

Is it possible to run a sequence of actions when clicking a hotspot?

Postby Ali87 » Tue Feb 28, 2017 12:12 pm

Hi,

Thank you for the help in my previous questions. Is there a way to make a sequence of actions when clicking on a hotspot?

For example, after the user clicks the hotspot, he/she will see a video modal appearing. When the video ends, the user will be moved to the next scene automatically.

Basically, what I am looking for is a way that prevents the user to skip some content (video, image, etc).

I am open to consider different methods to achieve this.

Regards,
Ali :roll:

User avatar
rroux
ForgeJS Team
Posts: 120
Joined: Wed Oct 26, 2016 12:19 pm

Re: Is it possible to run a sequence of actions when clicking a hotspot?

Postby rroux » Tue Feb 28, 2017 2:49 pm

Hello Ali,

Thank you for the help in my previous questions.


You're welcome!

Is there a way to make a sequence of actions when clicking on a hotspot?


Yes there is a way, you have to pass an array of actions uids

  1. "events":
  2. {
  3.     "onClick": ["action-0", "action-1"]
  4. }


This code will execute action-0 then action-1 but this will be at the same time. I mean you have no way to wait your video ends.
Plus I don't know anything about your modal code, so the thing I would recommend at the moment is to:

- Bind the action that opens the modal on the hotspot.
- In your modal code, listen to the end event of the video.
- When the video ends, add a callback manually that tells the viewer to load the next scene.

  1. // For the next scene
  2. viewer.story.nextScene();
  3.  
  4. // To load a specific scene uid
  5. viewer.story.loadScene("scene-uid");


If you code your video modal as a ForgeJS plugin, you can set an event on your plugin to trigger an action from the json when the video ends!

Hope this helps!
- Raphaël

Who is online

Users browsing this forum: No registered users and 2 guests