A Flash Developer Resource Site














Internet Commerce

Partners & Affiliates














Developer Channel

internet.com


Featured Flash FLA
Gallery Downloads 11336 Flash Movies | 2 New Flash Movies Added
What's New | Top 100

Featured FLA

» Author: Surjit Dhami
» Title: Book
» Description: Book
» More by Surjit Dhami


Random FLAs | Add Flash Movie
Featured Flash Site
Gallery Downloads 5848 Flash Sites | 0 New Flash Links
What's New | Top 100 Flash Site

Featured Site

» Posted in the Flash Kit Links section
» Title: All-American Rejects
» Description: Get to know this great band by exploring their "practice room".


Random Links | Add your own Flash Related Links
Flash Tutorials 1277 Tutorials 7 New Tutorials Added!
What's New | Top100

» Create xml slideshow with free template
» How to Insert a Multilingual Subtitle Into Your Flash Video Studio
» How to Create Cool Halloween Slideshow
» Debugging flash using the Firebug console
» Create Flash Slideshow on Blogger
» FLASH TRICKS IN WEB ADVERTISING: FLASH BANNERS
» HTML Photo Gallery Tutorial
» Create your first flash site – PART 1
» How to Make a Flash Photo Gallery
» Unknown Tag: Title10
Random Tutorial | Add Site

Webmaster (IL)
Next Step Systems
US-IL-Chicago

Justtechjobs.com Post A Job | Post A Resume


Tutorials Home What's New Top Rated Submit myTutes Random!

Search Tutorials


Tutorials Tutorials » Audio

Categories Flash Sound for Dynamic Sites
Author: Gonzalo Alustiza

 
Page 10
«prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 next»

Controlling sound playback from JavaScript

First of all let’s create an external JavaScript library to store our code. Using external code libraries is a must if you want to avoid filling your HTML with lots of <SCRIPT> tags. Remember that a JavaScript library is a text file with a .js extension. In this case our library will be named ‘soundtown.js’.

The JavaScript libraries may be created using a simple text editor, or pick your favorite code editor to accomplish the task.

A big advantage of using external code libraries is that whenever you need to make a change to the code, no matter if it is an update or a correction, there is a single place to modify, which greatly eases the task and preserves your sanity. This doesn't mean that you don’t need to test your code after modifications, it means that modifications are easier and don’t involve editing lots of web pages.

Once the library is created you'll need to reference it from HTML so the functions and data that contains can be called from your HTML code. To reference an external code library use:

<script SRC="soundtown.js">

Remember that the text between quotes should contain the relative or absolute path to your library and the name of the .js file that contains your code.

If your code library is written in a language other that JavaScript i.e. VBScript, you can add LANGUAGE="VBScript" to the <SCRIPT> tag so the browser loads the VBScript interpreter. There is no need to use LANGUAGE="JavaScript" since the browser assumes all code to be JavaScript code as default. Remember that (in Internet Explorer) mixing JavaScript code and VBScript code leads to longer load times for your pages because the browser needs to load the VBScript interpreter which takes time and consumes memory. As a rule of thumb, stick to only one scripting language and it will go fine.

Also bear in mind that it is recommended to insert references like the shown above between <HEAD></HEAD> tags to ensure your code is available as soon as possible.

To control sound playback from JavaScript we will need two functions, one to play the sound and a second one to stop the sound, all the code needed to implement this will go inside the code library we just created.

To simplify things we will have the code to play and stop sounds inside the same function so we use a simple function call but, depending on the parameters sent to the function it will play or stop sounds.

«prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 next»

» Level Intermediate

Added: : 2001-02-20
Rating: 6.34 Votes: 29
Hits: 4674
» Author
My name is Gonzalo Alustiza and I work as a chief developer at Soundtown Argentina. Soundtown is a ten year old music production company specializing in music for advertising and TV which started to develop sonification solutions for the Internet.
» Download
Download the files used in this tutorial.
Download (89 kb)
Get conversion and unzipping tools for PC and Mac here!

» Forums
More help? Search our boards for quick answers!

Please rate this tutorial, 10 is the top rating, you can also click the comments link to read/write a review.
10 9 8 7 6 5 4 3 2 1
Read or Post Comments
 
   
 

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs