Click to See Complete Forum and Search --> : This is odd - need advice pls


CalifNina
06-03-2003, 07:57 PM
I've almost got it figured out! Had two previous posts last evening and earlier today on trying to get sound files to preload and play -- but no answers. I just discovered something -- if someome would please read the scenario and advise how to begin to troubleshoot.

I learned the original code is actually correct even though it had not worked for me.Here's what took place:

(1) Within my original HTML file (with other javascript routines and HTML tags that work fine), I have a particular script routine in the HEAD section for preloading and playing audio files, then later in the BODY is where it actually gets called.... When I run this HTML file the audio files have not ever been heard or play when I 'mouseover' or 'onclick.' I did not notice the sound files even being preloaded.

(2) Just for grins - I copy/pasted ONLY the single script routine from the HEAD section and the single corresponding code from the BODY section and placed both in a separate HTML file (I made no changes to the code) - NOTHING ELSE was included in this new file, no other HTML code or javascript code. ---> I then ran this new file ... guess what? ---> everything worked!!

(3) So I now know for sure the code works properly.This is where I'm stumped. In essence, the same code within my original HTML file will not play audio (maybe it's not preloading), BUT if I take that same code, separate into another file and run it, I then actually see an indicator showing sound files are preloading. After that, all onmouseover's and onclicks work; I hear every sound file that has been setup.

I'VE COME A LONG WAY AND KNOW I'M REAL CLOSE AT LAST!! :D

QUESTION: Tips on what to look for in my original HTML file that is preventing this preload/play audio script from not working with everything else?? Some direction to get me started in initial troubleshooting pls.

havik
06-03-2003, 10:38 PM
So you got it to work in a separate file but in another it doesn't? A problem here could be other variables, functions, etc... from other scripts interferring with your code (such as the same variable name)

Havik

CalifNina
06-03-2003, 11:09 PM
Hi, thks for the reply.

Correct, works in a separate file but not the original.

I was thinking along the same lines as to what you suggested ... I'll have to go through the code and check for var names, function names, etc. I know one thing tho, there are two separate arrays with the same name "new Array()" but each in a diff function/script, wonder if that might be a prelude too.

Jona
06-03-2003, 11:49 PM
It's possible, if the variable is global; otherwise it shouldn't make a difference.

Jona

CalifNina
06-04-2003, 01:00 AM
Jona, good point. I did go check for that and neither are global, so that is crossed off the list.

I'll just keep working thru each line of code and see if I notice anything suspicious.

Jona
06-04-2003, 01:04 AM
Don't you just love debugging code? :p

Jona

CalifNina
06-04-2003, 07:50 AM
Exactly Jona!! :( especially when javascript is new, only been at it maybe a couple weeks max now, so I definitely do not know enough to just breeze on through. Anyone else would have probably resolved in a matter of minutes after looking thru all the code. :rolleyes: still working on it.

Jona
06-04-2003, 10:38 AM
A lot of times, believe it or not, it's a simple typo or syntax error. I got "object expected" when I was making a script last night, and it was because I used setTImeout() instead of setTimeout(). Notice the caps...

Jona

CalifNina
06-04-2003, 10:43 AM
Oooh yes ... good point. Thks for the tip, I'll pay attention to that.