Sound Effects
This can be utilized for audio feedback when tapping the screen, as shown below.
The element can also be utilized to accompany a transition with audio. To trigger playback from a transition, the ScriptAction
element is used.
The following example shows how sound effects elements can be used to accompany transition between visual states using animations:
To do so, we first start by loading our effects:
Then we define two states for our rectangle, and REVERSE
, specifying the expected rotation angle for each state:
To provide between-states animation, we define two transitions:
TIP
In addition to the play
function, a number of properties similar to the ones offered by are available. Examples are volume
and loops
. The latter can be set to SoundEffect.Infinite
for infinite playback. To stop playback, call the stop
function.
WARNING