Skip to main content
Known Participant
November 17, 2016
Question

Click sounds on quiz submit buttons

  • November 17, 2016
  • 2 replies
  • 753 views

Hi all,

I am currently Adobe Captivate 9 and I am wondering if it is technically possible to add a clicking sound to the Submit button

in the question slides?

I have looked into this and I am thinking that this is not feasible but I just want to confirm.

Thanks

Keith

    This topic has been closed for replies.

    2 replies

    TLCMediaDesign
    Inspiring
    November 17, 2016

    Put this in the head of the index.html after the <script> tag and make sure the Mouse.mp3 is in the ar folder:

    var interfaceObj, eventEmitterObj;

    window.addEventListener( 'moduleReadyEvent', function ( e )
    {
    interfaceObj = e.Data;
    eventEmitterObj = interfaceObj.getEventEmitter();
    initializeEventListeners();
    });

    function initializeEventListeners()
    {
    eventEmitterObj.addEventListener( 'CPAPI_SLIDEENTER', function ( e )
    {        
      for ( var i = 0; i < e.Data.si.length; i++ )
      {   
       if ( cp.model.data[ e.Data.si[ i ].n + 'c' ].accstr.indexOf( 'Submit' ) != -1 )
       {
        var str = cp.model.data[ e.Data.si[ i ].n  ].mdi;
        str = str.substring(0, str.length - 1);
        var submit_btn = document.getElementById( str );
        submit_btn.addEventListener( 'click', playSound )   
        break;
       }    
      }
    });
    }

    function playSound()
    {
    var audio = new Audio('ar/Mouse.mp3');
    audio.play();
    }

    TLCMediaDesign
    Inspiring
    November 17, 2016

    I tested this code in CP8 and it works. You could also add the click sound to all of the buttons on the quiz slide.

    TLCMediaDesign
    Inspiring
    November 17, 2016

    You should be able to do this with JavaScript if HTML5.

    My CP9 is crashing right now and will more than likely need to be reinstalled, so I can't try it.

    Will look at CP8 as the output is the same.