Hexagora Forum
Hexagora Forum
Home | Profile | Active Topics | Members | Search | FAQ
 All Forums
 Dynamic HTML Editor
 Dynamic HTML Editor
 How to start playing a .wav file on a mouse over?

Note: You must be registered in order to post a reply.

Screensize:
UserName:
Password:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert Email Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
   

T O P I C    R E V I E W
Joseph Wolf Posted - 27 Dec 2004 : 07:28:40
I'm trying to start playing a sound file (sound.wav) on rolling the mouse over an object. I surmise I have to go into the <Event Editor> for that object, select the event <onMouseOver> and the action <JavaCall>. Then I am prompted to write a "Java Call", and this is where I get stuck. What would be the proper syntax to start playing a wave file (or am I approaching this completely the wrong way)?

Thanks in advance for the information.

JW
3   L A T E S T    R E P L I E S    (Newest First)
s.dav Posted - 28 Dec 2004 : 09:49:23
Contact me using the 'contact us' page in the site and I'll send you a sample taken from Dynamic HTML Editor 2.0
Joseph Wolf Posted - 27 Dec 2004 : 15:16:01
Hi Davide,

Thanks for your prompt reply. I've tried to make sense of your instructions, but I don't seem to get anywhere. From what I understand, I need to manually add a few lines to the HTM file generated by Dynamic HTML Editor, is that correct? I have generated the simplest possible case: just a rectangle for which I am trying to play a sound on the rollover of the mouse. Since it is so short, I am listing it below (I took the liberty to number the lines, to make things easier in terms of referencing):

01 <html>
02 <head>
03 <!-- Created by Dynamic HTML Editor http://www.hexagora.com -->
04 <META NAME="GENERATOR" CONTENT="Dynamic HTML Editor v.1.7.25 -
http://www.hexagora.com">
05 <SCRIPT LANGUAGE=javascript>
06 <!--
07 var isNS=document.layers?true:false;
08 var isIE=(document.all!=null)||(navigator.appName.toLowerCase().indexOf('microsoft
internet explorer')!=-1);
09 var isDom2=document.getElementById;
10 var fVers=parseFloat(navigator.appVersion);
11 if ((isNS && fVers<4)||(isIE && fVers<4))
12 alert('Your browser is very old. Please upgrade if you want to see
this page correctly.');
13 //-->
14 </SCRIPT>
15 <SCRIPT LANGUAGE=javascript src='files/dhe.js'></SCRIPT>

16 <title></title>
17 <link rel='stylesheet' href="files/test.css"></link>
18 </head>
19 <body SCROLL='auto' TEXT='#000000' BGCOLOR='#FFFFFF' TOPMARGIN='0'
LEFTMARGIN='0' LINK='#0000FF' VLINK='#800080' ALINK='#FF0000'>

20 <div id='ldheRect1' name='ldheRect1'
style='position:absolute;left:40px;top:40px;width:351px;height:271px;'
align='left' valign='top'>
21 <a href="#" onmouseover="jsPlay('Audio1');return false;">
22 <img id='Rect1' name='Rect1' src='files/test_rect1.png' border='0'
width='351' height='271'></img></a></div>
23 </body>

24 </html>



Now, here are the instructions you provided me with (again, I took the liberty to number your lines):

25 <!-- your audio object -->

26 <div id="ldheAudio1" style="position: absolute; left: 140px; top: 140px;"
align="left">
27 <embed id="Audio1" name="Audio1" src="ding.wav" width="106" height="71"
autostart="false" hidden="false" volume="100" loop="false"></div>

28 <!--The javascript call may be:-->

29 jsPlay('Audio1');

30 <!--where jsPlay is (put this in the head code of your page) :-->

31 function jsPlay(n) {var o;if (o=getLayer(n)) {o.play();}}



I see a certain similarity with "your line 26" and "my line 20" but I don't know if the differences are relevant or not:

26 <div id="ldheAudio1"

style="position: absolute; left: 140px; top: 140px;"

align="left">


20 <div id='ldheRect1'
name='ldheRect1'
style='position:absolute;left:40px;top:40px;
width:351px;height:271px;'
align='left' valign='top'>


I do not see in "my" HTM file any line matching "your line 27":

27 <embed id="Audio1" name="Audio1" src="ding.wav" width="106" height="71"
autostart="false" hidden="false" volume="100" loop="false"></div>

??

This line looks like absolutely necessary, since it is where the relationship between "Audio1" and "ding.wav" is established, as well as the parameters to properly play the sound.


As to the instruction you gave me on "your line 29", it seems to appear in "my line 21", through my entering of "jsPlay('Audio1')" in the <Java Call> field of Dynamic HTML Editor.

29 jsPlay('Audio1');

21 <a href="#" onmouseover="jsPlay('Audio1');return false;">


Finally, I am not exactly sure where I should place the instruction you gave me on "your lines 30 and 31", since I can see two locations with the code <head> (in "my line 02 and 18").



Well, to summarise, I think it comes down to 3 questions:

1) Where (after which line number) should I insert "your line 27"?

2) Where (after which line number) should I insert "your line 31"?

3) Are there any other codes either missing, or to be altered?


Maybe you will spot the problem right away. I hope it does not cause you too much problems. Thanks again.

JW
s.dav Posted - 27 Dec 2004 : 08:38:06
You are right, the method you have to invoke is 'play()'
so the code can be like this (taken from Dynamic HTML Editor 2.0)

<!-- your audio object -->

<div id="ldheAudio1" style="position: absolute; left: 140px; top: 140px;" align="left">
<embed id="Audio1" name="Audio1" src="ding.wav" width="106" height="71" autostart="false" hidden="false" volume="100" loop="false"></div>

<!--The javascript call may be:-->

jsPlay('Audio1');

<!--where jsPlay is (put this in the head code of your page) :-->

function jsPlay(n) {var o;if (o=getLayer(n)) {o.play();}}

Hexagora Forum © s.dav Go To Top Of Page
Snitz Forums 2000