Extension activity 2: Adding sound asset to the app

For an additional enhancement, let's integrate a sound asset into the app. Follow these straightforward steps to incorporate a sound file along with the button component.

  1. Navigate to the left panel (Panel 1) and click on the Media tab. Drag and drop the Sound component onto the screen. Note that the sound component is non-visible, so you won't see any changes on the screen.

  2. Upload a WAV sound file, similar to how you uploaded the image file.

    Locate the sound file (switch-1.wav) within the Media folder.

  3. Click on Sound1 in the Components tree. From the Properties panel, select the uploaded sound file as the Source.

  4. Switch to the Blocks tab and click on Sound1. Drag the call Sound1.Play block.

  5. Move the Play block inside both the if and else parts of the existing code. The final code should resemble the image below:

All done!!!

Last updated