473,385 Members | 1,872 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

a better way of clicking images in sequence?

Hello,

The code below works but can anyone suggest a better way of doing the
following?

The idea is that there are 3 images which when clicked each play a
different sound and change to a different image.

I want to have the user hear the sounds in sequence and also not to
play the next sound until the previous sound has finished.

Cheers

Geoff
<script type="text/javascript">
var egfinished1="no";
var egfinished2="no";
var egclicked1="no";
var egclicked2="no";
</script>

<h2>First Sound</h2>

<IMG alt="image" id="IMGa" src="../assets/images/play1.gif"
onClick="egclicked1='yes';document.getElementById( 'IMGa').src='../assets/images/play2.gif';
soundManager.createSound({id:'mySound1a',url:'../assets/audio/Track27.mp3',
onfinish:function(){egfinished1='yes'}
});
soundManager.play('mySound1a');
this.disabled='true'">

<h2>Second Sound</h2>

<IMG alt="image" id="IMGb" src="../assets/images/play1.gif"
onClick="
egclicked2='yes';
if (egclicked1 !='yes'){
alert('Play the first sound');
return;
} else {
if (egfinished1 == 'yes') {
document.getElementById('IMGb').src='../assets/images/play2.gif';

soundManager.createSound({id:'mySound2a',url:'../assets/audio/Track28.mp3',
onfinish:function(){egfinished2='yes'}});
soundManager.play('mySound2a');
} else {
alert('click again when first sound finished');
return;
}
}
;this.disabled='true'">

<h2>Third Sound</h2>

<IMG alt="image" id="IMGc" src="../assets/images/play1.gif"
onClick="
if (egclicked1 !='yes'){
alert('Play the first sound');
return;
} else {
if (egclicked2 !='yes') {
alert('play the second sound');
return;
} else {
if (egfinished2=='yes') {
document.getElementById('IMGc').src='../assets/images/play2.gif';

soundManager.createSound({id:'mySound3a',url:'../assets/audio/Track29.mp3'});
soundManager.play('mySound3a');
} else {
alert('click again when second sound finished');
return;
}
}
}
;this.disabled='true'">
Jun 27 '08 #1
1 894
On Tue, 29 Apr 2008 13:44:00 +0100, Geoff Cox <gc**@freeuk.notcom>
wrote:
I should have added that the 3 sets of code have to be separate as
there is descriptive text in between.

Cheers

Geoff
Jun 27 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Richard | last post by:
www.somestuff.batcave.net Just a simple photo gallery of my own design. What I want to do works quite well in javascript. But I'm thinking it might be better off in php. Just a few thumbnails...
1
by: PWalker | last post by:
Hi, I have several webpages that have around 50+ thumbnail images in it in a table structure spanning (3 columns) x (17+ rows). Each thumbnail is wrapped in the following piece of javascript: ...
3
by: Ricardo Sanchez | last post by:
Hello, I'm trying to upload images to http://imageshac.us via a Python script. I have looked at the POST request with HTTPLiveHeaders Firefox extension when I upload an image, but I can't...
2
by: chrisse_2 | last post by:
Hi, I am working with images which vary depending on what record you are looking at. The images are linked into my database using vba code. I would like the user to be able to double click on...
14
by: EdB | last post by:
We are having an odd problem saving images. We capture customer signatures on a Palm Pilot and save them as points on a graph. We are able to reconstruct these points to display the signature,...
10
by: Neo Geshel | last post by:
I am seeking to hand-roll my own blog in ASP.NET 2.0 and SQLExpress 2005. Why? Because I can. Because I will gain experience. The one thing that has me stumped at square one is inline images....
11
by: Jason Camp | last post by:
Since we are unable to use IIS on our developer workstations due to security policy, we would like to use the internal web server baked into VS.NET 2005. The problem that I am currently running...
3
by: vj | last post by:
how to change images based on action. Even clicking changed images should do respective actions. and while displaying only one image at a time sholud get displayed. I am using three images for a...
7
by: Keith Hughitt | last post by:
Hi all, I am having trouble preloading images in a javascript application, and was wondering if anyone had any suggestions. Basically I have a bunch of images stored in a database as BLOBs. At...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.