Different music on image popup

Q&A about the latest versions
Post Reply
PanEpicki
Posts: 7
Joined: Wed May 26, 2021 2:16 pm

Hi Hopki,

I followed your great tutorial of images popup:
viewtopic.php?t=14304

It works great. Now what I want to do is when I click a polygon hotspot with an image popup to stop the default panorama background music and start playing some other music. And then when I close the image popup I want it to stop image music and play the basic panorama background music again. I hope it's clear enough ;)

Thanks for any help,
Mario
User avatar
Hopki
Gnome
Posts: 13004
Joined: Thu Jan 10, 2008 3:16 pm
Location: Layer de la Haye, Essex UK
Contact:

Hi Mario,
Please see the attached project.

project.zip
(2.59 MiB) Downloaded 83 times

There are three mp3 files, Take My Hand short.mp3 is the background sound.
Then there are dog.mp3 and cat.mp3 files.

The background sound is added to the node using the properties panel as background sound should be added.
The dog and cat sounds are added to the project's assets, the same way the dog and cat popup images were.

Select the dog Polygon Hotspot and in the Hotspot Properties Panel, you will see in the Target text field the dog mp3 file, dog.mp3.
It's the same for the other Polygon Hotspot that opens the cat image, but this time the Target is cat.mp3.
So each Polygon has is related MP3 file.

In the skin there is a "video" element with the ID, FXPlayer, this is used to play the sound.
In the video elements properties, deselect Autoplay and if you need it select loop.

1.png
1.png (25.31 KiB) Viewed 992 times

You need to add a few actions to the linked container "Open Image Popup".

2.png
2.png (63 KiB) Viewed 992 times

1 Set Volume to 0 for the background sound
2 Set Value assets/$(ht), FXPlayer, this loads the MP3 in the video element
3 Plays the MP3 in the video element FXPlayer

Then in the close button, you need two more actions:

3.png
3.png (44.41 KiB) Viewed 992 times

4 Set Volume back to 1 for the background sound
5 Stop Media, FXPlayer

Why did I do it this way and not just add sound to the nodes?
This way I only need to play and stop the FXPlayer.
But I can use a set value action to load different sounds to the FXPlayer.

If you added the different MP3 files to the nodes, you would end up with Element01, Element02 etc, so the stop button would need to have an action to stop each MP3 so having many actions or you would need to use regular expressions.
Regards,
Garden Gnome Support
If you send an e-mail to support please send a link to the forum post for reference.
support@ggnome.com
https://ggnome.com/wiki/documentation/
PanEpicki
Posts: 7
Joined: Wed May 26, 2021 2:16 pm

Everything works great. Thank you very much!
PanEpicki
Posts: 7
Joined: Wed May 26, 2021 2:16 pm

Hi Hopki!

I have noticed one thing:
When I click close button it changes the music to previous and its ok but when I just click outside of pop up picture (witch also close the pop up picture) the music stays (music from the picture).
Is there something I can do about it?

Thanks!
PanEpicki
Posts: 7
Joined: Wed May 26, 2021 2:16 pm

I resolve my problem with copying sound actions from close button to screentint and I think it works fine ;)
User avatar
Hopki
Gnome
Posts: 13004
Joined: Thu Jan 10, 2008 3:16 pm
Location: Layer de la Haye, Essex UK
Contact:

:D
Garden Gnome Support
If you send an e-mail to support please send a link to the forum post for reference.
support@ggnome.com
https://ggnome.com/wiki/documentation/
Post Reply