Question from Box audio text

Hello good afternoon.

So I am doing a class project and would like to add audios to the text boxes. But these boxes are made in groups and it is not possible to put audio in them.
My question is if I can add some kind of javascript on the page along with those already there so that it is possible to play the audios that are on the slide, one at a time respecting their sequence when switching the box.

Or if I could play all the audios on the master slide and on each slide pull the audio with their respective name.

follows the attached template.!0h111YDR!i3Y0Ya3WMp1jF2Nd2mPIfaEwzstbdtu9bsZ4m4RJme0

Windows 7


You just need to call animate(AP.EffectType.MEDIA_PLAY) on the audio object instead of the text box.

// remove or comment out these lines:
// play attached audio

// replace them by these lines
// play next audio
prez.object('ReTr_02a_1_' + nextIndex).animate(AP.EffectType.MEDIA_PLAY);


Worked perfectly. But if I click on the next box, the audios will mix, how do I pause the audio when the box is ‘hide’?
I’m not very good at Javascript xD

Sorry, I didn’t notice the line that stops the audio (this.animate(AP.EffectType.MEDIA_STOP);) in your code. You should call it on the current audio object.
The entire script will be:

//Variavel caixa normal
var namePrefix = 'caixa_';

var audioPrefix = 'ReTr_02a_1_';

//Variavel caixa Indica
var nameCaixaIndica = 'caixaIndica_1';

var clickHandler = function() {
  //Variavel do contador 
  var nextIndex = parseInt( + 1;
  // Stop current audio
  prez.object(audioPrefix + (nextIndex - 1)).animate(AP.EffectType.MEDIA_STOP);

  //Variavel proxima caixa
  var nextObject = prez.object(namePrefix + nextIndex);
  //Variavel proxima caixa Indica
  var caixaIndica = prez.object(nameCaixaIndica);
  //Se caixa hide = show e inicia audio
  if (nextObject) {;
    // play next audio
    prez.object(audioPrefix + nextIndex).animate(AP.EffectType.MEDIA_PLAY);
  //Se caixaIndica = hide = show
  else if (caixaIndica){;
  //Se terminou proximo slide
  } else {
1 Like

How do I add to a variable without having to set it? something like this:

var audioAula = prez.variable(“apMudarAudio”);

else {
prez.variable(“apMudarAudio”) +1; how do I do this implementation?

I already got xD

var audioAula = prez.variable(“apMudarAudio”);

else {
prez.variable(“apMudarAudio” , audioAula + 1);

1 Like