<clip id='string' url='string' stream='number' timeout='number' retry='number' />
sound encloses any number of clip tags, each loads a sound to make available for actions to play.
The sound tags must be at the top level of the XML Source (outside of any <object> tags).
Each sound clip has the following attributes:
- id: Any unique ID to identify the sound clip. If the same ID is used by multiple sound clips, then the last loaded clip replaces the existing one.
- url: Relative or absolute URL of an MP3 sound clip to play.
- stream: The number of seconds to preload and buffer the sound before making it available for playing. This can be used to stream large clips and start playing before they are fully loaded.
- timeout: The number of seconds to wait before the clip loading times out. The default is 30 seconds.
- retry: The number of times to try loading the clip before displaying a loading error message. The default is 2 (try twice).
The sound tags can be placed within any object and used by any other object. However, they must be loaded with or before the object that makes use of them.
To make sounds available to all objects immediately, place the sound tags at the top level of the XML Source (outside of any <object> tags).
Playing a Sound
Use actions to play sound clips loaded with the <sound> tags. Actions can be triggered by events that can be a user click, billboard activity, or a timer triggered after a time delay.
<!-- sound clips to load -->
<clip id='music' url="sounds/slow.mp3" />
<clip id='yeah' url="sounds/yeah.mp3" />
<!-- timer action triggerd after a one second delay -->
<!-- the timer plays the first sound twice -->
<item type='sound_play' target='music' loop='2' event='timer' delay='1' />
<!-- a button that plays the second sound when pressed -->
<rect x='205' y='50' width='70' height='30' fill_color='FF6600' shadow='default' state='hit' />
<text x='205' y='55' width='70' alpha='.6' align_h='center' shadow='default'>Play</text>
<item type='sound_play' target='yeah' />
<shadow id='default' />