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.
Navigate to the left panel (Panel 1) and click on the
Media
tab. Drag and drop theSound
component onto the screen. Note that the sound component is non-visible, so you won't see any changes on the screen.Upload a WAV sound file, similar to how you uploaded the image file.
Locate the sound file (
switch-1.wav
) within the Media folder.Click on
Sound1
in theComponents
tree. From theProperties
panel, select the uploaded sound file as theSource
.Switch to the
Blocks
tab and click onSound1
. Drag thecall Sound1.Play
block.Move the
Play
block inside both theif
andelse
parts of the existing code. The final code should resemble the image below:
All done!!!
Last updated