Hey,
So I have a small Flash application that plays a sound when a new message is received in a chat-box. The flash player is on a page embeded with an iframe.
<iframe width="1" height="1" frameborder="0" name="alerter" src="/chatbox/flash/alert/sound.php" id="chat_alert"></iframe>
In the parent window, a variable called new_message is used to keep track of wether it is a new message or not
if ( new_last_message != last_message ) {
last_message = new_last_message;
new_message = true;
}
Then code within the iFrame checks this, if it is a new message then it plays the sound
function run_sound() {
getMovie('viewer').new_msg();
}
function getMovie(movieName) {
if (navigator.appName.indexOf("Microsoft") != -1) {
return window[movieName];
} else {
return document[movieName];
}
}
function check_new() {
if ( parent.new_message == true ) {
if ( parent.first_load == true ) {
parent.first_load = false;
parent.new_message = false;
} else {
parent.new_message = false;
run_sound();
}
}
//alert('Running Subfunction');
setTimeout('check_new()', 100);
}
It works fine in every browser except IE which gives me the error Object Doesn't support this property or method
refferencing line 309 of the file ( getMovie('viewer').new_msg();
)
Why is it only doing this in IE, it works fine in Safari, Firefox and Chrome
The chatbox can be viewed at http://forum.dftba.com/ (You need to have signed in but the accounts are free)