Embedding Sound with Flash, Part III: Streams

Suppressing JavaScript Error Messages

Suppressing error messages is a controversial issue in all programming languages. That's a classical programmer dilemma. Should a program scream when a bug is found, or should the bug go unnoticed? Since this is almost a "religious" issue, it is left for your own decision. What is not questionable is the need for error messages during the early development stages of the program. In this phase, you probably need the error messages for debugging your new script.

The FlashSound JavaScript API lets you choose whether to suppress error message or not, with the muteErrorMsg property of the FlashSound object. Notice the double negative here. In order to suppress error message, you need to set this property to false. Set it to true during the debugging phase. The default setting is true, i.e. error messages are suppressed by default.

The following JavaScript code includes an error, because the variable a is not defined:

<SCRIPT LANGUAGE="JavaScript">
FlashSound.muteErrorMsg = a;
</SCRIPT>

We can choose to get or suppress an error message for this JavaScript error. The following script will suppress the error: