Problem Reading Cookie in Internet Explorer

I have a php script that I call from a Flash movie to set a cookie. The purpose of this cookie is to have the sound turned on or off as a person moves through the site. Everything works fine in FireFox, but in Internet Expolorer (version 6.0.2800.1106 for what it’s worth) it won’t recognize the cookie until I close IE and open it again - then it does recognize it.

Here’s my code:

<?php
    $expire = time() + (60*60*24*365*10);
    if($_GET['mode'] == 1){
        //Sound on
        setcookie("audioCookie", 1, $expire, "/", ".mydomain.com", false);
        print 'sound=1&setting';
    } else if($_GET['mode'] == 0){
        // Sound off
        setcookie("audioCookie", 0, $expire, "/", ".mydomain.com", false);
        print 'sound=0&setting';
    } else {
        // Checking status
        print 'sound='.$_COOKIE['audioCookie'];
    }
?>

To check the status I use the following AS (In case it matters, I’m working in Flash MX):
[AS]audioVars = new LoadVars();
sendVars = new LoadVars();
sendVars.mode = 3;
audioVars.onLoad = function() {
_root.soundCheck = audioVars.sound;
if (audioVars.sound == “0”) {
sound_mc.gotoAndStop(2);
}
};
sendVars.sendAndLoad(“sound.php”, audioVars, “GET”);[/AS][FONT=Courier New][/FONT]

Any thoughts on how I can fix this?

Bump . . .

I’m pretty sure my AS is not the problem. But for some reason IE won’t recognize the cookie until I close the browser and re-open it.

Anyone . . . ?

Bump . . .

I’m pretty sure my AS is not the problem. But for some reason IE won’t recognize the cookie until I close the browser and re-open it.

Anyone . . . ?

Well, I got it working in IE. I added a variable named rnd (a random number) that evidently forces IE to take a ‘fresh look’ at the cookie. Here’s the code I ended up with:

<?php
    $expire = time() + (60*60*24*365*10);
    if($_GET['mode'] == 1){
        //Sound on
        setcookie("audioCookie", 1, $expire, "/", ".mydomain.com", false);
        print 'sound=1&setting';
    } else if($_GET['mode'] == 0){
        // Sound off
        setcookie("audioCookie", 0, $expire, "/", ".mydomain.com", false);
        print 'sound=0&setting';
    } else {
        // Checking status
        print 'sound='.$_COOKIE['audioCookie'];
    }

?>

[AS]audioVars = new LoadVars();
sendVars = new LoadVars();
sendVars.mode = 3;
sendVars.rnd = Math.round(Math.random()*100000);
audioVars.onLoad = function() {
_root.soundCheck = parseInt(audioVars.sound);
if (_root.soundCheck < 1) {
sound_mc.gotoAndStop(2);
}
};
sendVars.sendAndLoad(“sound.php”, audioVars, “GET”);[/AS]

I did the same thing to the buttons that set the cookie:
[AS]on(release){
gotoAndStop(2);
audioVars = new LoadVars();
sendVars = new LoadVars();
sendVars.mode = 0;
sendVars.rnd = Math.round(Math.random()*100000);
sendVars.sendAndLoad(“sound.php”, audioVars, “GET”);
}[/AS]
[AS]on(release){
gotoAndStop(1);
audioVars = new LoadVars();
sendVars = new LoadVars();
sendVars.mode = 1;
sendVars.rnd = Math.round(Math.random()*100000);
sendVars.sendAndLoad(“sound.php”, audioVars, “GET”);
}[/AS]