Add sound after dropping an item

Hello.

Is it possible to add a sound effect after dragging the books to the grey rectangle?
Sound after dropping.hype.zip (2.3 MB)

Thank you,
Regards,

load a sound into the resource-library. create a timeline, which is playing the sound.
call this timeline from your javascript, when the element is placed correct.
for example: when you finished all draggable:

function checkForCompletion(){
  if (correctDrops === dropElements.length) {
    $(message).html("Correct!");
     hypeDocument.startTimelineNamed('finSound', hypeDocument.kDirectionForward);
  }
}
1 Like

Thank you strmiska. SInce I am not familiar with JavaScript coding, can you please apply the code you mentioned to the following file?Sound after dropping.hype.zip (2.3 MB) I want a sound to play after the user drags the books to the grey rectangle.

Thank you.
Regards,

@krystelyb

Just to make this clear. Whilst we try our best to help individuals with their Hype projects we cannot just simply do the work for you. There has to be a willingness to learn but also do not over stretch yourself by including code in your work that you do not understand.

Again, the code above, if you check against what you already have would be easy to see where it needs to be added. I would suggest adding it first and if you then have problems then come and ask why it’s not working. You will find very quickly that if you just say … here is my document can you put it in where it is supposed to be? … you will get less and less help :wink:

3 Likes