ReadAloud Toggle custom button?

  1. 7 weeks ago
    Edited 7 weeks ago by Anastasia M

    Hello!

    On my first screen, I have an onLoad event attached to an image that runs this Javascript:

    XPUB.callAppMethod("StartReadAloud", []);

    It works fine, and starts the read aloud.

    On the subsequent screens, I would like to have an icon to toggle read aloud on and off. I really do want to be able to do this using my own custom image as the button.

    I have an image of a speaker with a Tap event attached, which runs this Javascript

    if (XPUB.callAppMethod("ReadAloudStarted"), []){
    XPUB.callAppMethod("StopReadAloud", []);
    }

    This works to STOP the readaloud, anytime I press the icon.

    I cannot figure out how to make it toggle to START the readaloud up again, using the same image. I've played with the ReadAloudStopped event, creating a toggle variable at Global or local level to track if it's on or off, and don't seem to be hitting on the right combination of events and code. It would be great to write the

    Do you have any suggestions? Thank you in advance.

  2. 4 weeks ago

    Angelo S

    Dec 2 Administrator

    There's an example for this in the Example Project

 

or Sign Up to reply!