Vectorials
Flash Perfection
3D Lessons
Tutorialkit
Markup Tutorials
Learn PHP
network
Flash & Swish  Home Flash & Swish Swish Tutorials Play and Stop Control In Java Script
rss

Play and Stop Control In Java Script

Author: timdav83 More by this author


1. Add this code inside the body tags:

<script language="Javascript">

n = (document.layers) ? 1:0
ie = (document.all) ? 1:0
function play_sound() {
   if (n) document.thesound.play(false)
   if (ie) {
       document.thesound.stop()
       document.thesound.play()
   }
}
function stop_sound() {
   document.thesound.stop()
}
</script>
<embed src="http://your.host.com/midifile.mid" hidden=true autostart="false" mastersound name="thesound">

2.Create a new swish movie and name it whatever you want

3. Create some stop and play buttons, text, etc

4. Insert this in the action of the play button:

on [release]
 Goto URL: javascript:play_sound();

5. Insert this in the action of the stop button:

on [release]
 Goto url: javascript:document.thesound.stop()

The music file can be anything from midi, wav, or an mp3 file. The most interesting part is, it's from and external source and does not use any plugin.

I'll create a web site with the tutorial because the formating doesn't seem right.



Author's URL: www.swish-db.com

Rate this Material: Bad 1 2 3 4 5 Excellent
print this page tell a friend subscribe to newsletter subscribe to rss

Add comments to "Play and Stop Control In Java Script"