|
||||||
|
||||||
Tutorial: Flash Sound on HTML Web Pages using JavaScript

Free Flash Sound Tutorial
Step 2 << Previous • Intro
1
2
JavaScript • Next >>
|
Step Two: Setting up the Web Page
<script language="JavaScript" src="flashsound.js"></script>
<script language="JavaScript">
var mysound = new FlashSound( );
</script>
<script language="JavaScript">
mysound.embedSWF("Sound.swf");
</script>
Note: If your Flash Movie is not called: Sound.swf - you will need to change the code above.
The next bit of code plays a sound on rollover and stops playing sound on rollout.
The sound will play continuously:
<a href="javascript://" onMouseover = "mysound.gotoAndPlay('/SoundPlayer',
'loop')"onMouseout = "mysound.gotoAndStop('/SoundPlayer','stop')"onClick
= "return false"> Rollover here To Start Playing Sound </a>
To have the sound play once when the page loads use this code:
<body onLoad="mysound.gotoAndStop('/SoundPlayer',
'start')">
Or to have the sound play continually, place this code in the Body Tag:
<body onLoad="mysound.gotoAndStop('/SoundPlayer',
'loop')">
The following Body Tag will preload the Flash file:
<body onLoad="mysound.gotoAndStop('/SoundPlayer', 'stop')">
Note: The start, loop and stop in the code above relates to the frame labels that you created in the Flash Movie.
You can have different sounds on different links by adding additional sounds in your Flash Movie:

Multiple sounds and loops have been added for different links on the web page.
Then refer to each individual sound or loop like so:
You can download an example web page to see how to code your web page here
For advanced users who want to experiment, the following is a list of commands that you can use:
mysound.gotoAndStop('/SoundPlayer', 'start')"
mysound.gotoAndPlay('/SoundPlayer', 'start')"
return false
For other tutorials on how to use this technique:
|
Step 2 << Previous • Intro 1
2 JavaScript • Next >> |
Why not try out webwasp's new community. Meet new people, find friends in your area: Webwasp Mates & Dates
|
|
|
All material on this site is protected under international copyright © law. DO NOT reproduce any material from this site without written permission. Please ask as permission is often granted.
|