Sound of objects in JS

Problem:
Hi, I have a sound attached to a shape which is initially hidden. When I show the shape (on click from another shape) the object appears and the associated sound plays automatically, as I want it to.

Because I use this kind of thing many times, I want to use an advanced action that makes use of the following JS-code:

var ObjName = "Info_" + this.name();
prez.object(this.name()).state('Disabled');
prez.object(ObjName).show(AP.EffectType.FADE_IN, 500);

The object itself shows but the sound does not play.

Can you help me?

Thanks,

Rolf

ActivePresenter version: 8

OS: win 10

Notes:

Hi Rolf,

Unfortunately, the show object function behaves differently compared to the Show Object action. It just modify the visibility state but not play its attached audio.
Please use the Show Object and Change Object State actions when designing Advanced Action instead of calling the show function of the object. It will look like the below screenshot:

image

Regards,

Thanks, Dao,

hmmm, that does not really work. The way I understand the use of parameters in advanced actions is that every time I have an advanced action I then have to pick one of the available choices for a given parameter from the pull down menu.
This would mean more work than manually assigning a given action which shape (+ sound) to show. Or do I understand the parameters wrong?

For may use case I would then rather choose to record an audio separately and play it through JS. Could you help me with the line of code that could do that?

Best,

Rolf

Hi Rolf,

This thread may help:

Regards

1 Like