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.
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]
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:
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]