SlickBoard | CSS/XML Timeline (new) | XML/SWF Charts | Timeline Eons

 < previousnext > 

 

Sound

 

<action>

     <item type='string' target='string' loop='number' volume='number' />
     ...
   
</action>
             


Description

The action tags can be added to an object and enclose any number of items, each executes an action when triggered by an event:

 

  • type: The type of action to execute. The type values that control sounds are:

    • sound_play: Play a sound clip. If the sound is already playing, then this action has no effect. If the sound was paused, then this action resumes it.

    • sound_new: Play a new instance of a sound clip. If this action is executed multiple times, then it produces several overlapping sounds. Other actions such as pause and resume affect all instances of the same sound clip. To manage sounds separately, load a sound clip multiple times and give each a different ID.

    • sound_stop: Stop a sound.

    • sound_pause: Pause a sound and remember the pause position.

    • sound_resume: Resume a paused sound from the pause position. If the sound was not paused before it finished playing, then this action has no effect. Use sound_play to either play a sound or resume it.


    • sounds_stop: Stop all sounds.

    • sounds_pause: Pause all sounds. Use the sounds_resume action to continue playing the sounds from their pause positions.

    • sounds_resume: Resume all paused sounds.


    • sound_volume: Set the volume of an individual sound clip.

    • global_volume: Set the global volume, which affects all sound clips. The actual volume of each sound clip equals sound_volume multiplied by global_volume.


  • target: The ID of the sound clip to apply this action to.

  • loop: The number of times to repeat the sound. This attribute is used only when the action type is sound_play or sound_new. Valid values are 1 and above. The default is 1.

  • volume: The volume setting. This attribute is used when the action type is sound_volume, global_volume, sound_play, or sound_new. Valid values range from 0 to 1. The default is 1 (full volume).

 

Example

<slickboard>

   <!-- sound clip to load -->
   <sound>
      <clip id='music' url="sounds/slow.mp3" />
   </sound>
   
   
   <!-- a play button that plays a sound at 50% volume -->
   <object>   
      <rect x='115' y='50' width='70' height='30' fill_color='FF6600' shadow='default' state='hit' />   
      <text x='115' y='55' width='70' alpha='.6' align_h='center' shadow='default'>Play</text>   
      <action>
         <item type='sound_play' target='music' volume='.5' />
      </action>
   </object>
   
   <!-- a button that pauses the sound -->
   <object>   
      <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'>Pause</text>   
      <action><item type='sound_pause' target='music' /></action>
   </object>
   
   <!-- a button that resumes the sound -->
   <object>   
      <rect x='295' y='50' width='70' height='30' fill_color='FF6600' shadow='default' state='hit' />   
      <text x='295' y='55' width='70' alpha='.6' align_h='center' shadow='default'>Resume</text>   
      <action><item type='sound_resume' target='music' /></action>
   </object>
   
   <!-- a button that stops the sound -->
    <object>   
      <rect x='115' y='100' width='70' height='30' fill_color='FF6600' shadow='default' state='hit' />   
      <text x='115' y='105' width='70' alpha='.6' align_h='center' shadow='default'>Stop</text>   
      <action><item type='sound_stop' target='music' /></action>
   </object>
   
   <!-- a button that sets the volume to 1 (default) -->
   <object>   
      <rect x='205' y='100' width='70' height='30' fill_color='FF6600' shadow='default' state='hit' />   
      <text x='205' y='105' width='70' alpha='.6' align_h='center' shadow='default'>High</text>   
      <action><item type='sound_volume' target='music' /></action>
   </object>
   
   <!-- a button that sets the volume to .1 -->
   <object>   
      <rect x='295' y='100' width='70' height='30' fill_color='FF6600' shadow='default' state='hit' />   
      <text x='295' y='105' width='70' alpha='.6' align_h='center' shadow='default'>Low</text>   
      <action><item type='sound_volume' target='music' volume='.1' /></action>
   </object>
   
   
   <filter>
      <shadow id='default' />
   </filter>
 
</slickboard>

 

 < previousnext > 


Copyright © 2010-2017, maani.us