Our Swish tutorials provide you with step-by-step instructions on how to create beautiful Flash animations and integrate them into your website.  Home Flash & Swish Swish Tutorials Play and Stop Control In Java Script
Your Ad Here

Play and Stop Control In Java Script


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: timdav83
Thank you for voting.
Rate this Materials:
Bad 
1 2 3 4 5 Excellent
Share print this page subscribe to newsletter subscribe to rss

Our Swish tutorials provide you with step-by-step instructions on how to create beautiful Flash animations and integrate them into your website. More Flash & Swish: Most Popular Materials | Fresh Materials | More Swish Tutorials at FlashPerfection.com

No comments yet...
Add comments to "Play and Stop Control In Java Script"

Captcha