So I’ve created cookies (sorry title says session) that will track the state of a button based on the php page-
Here’s the working model: http://projectrab.com/MOSAIC/derma/
The problem is: if you visit the url and click about/info button (notice the text to the right of the swf that changes) and close the browser, reopening your browser and returning to the URL will result in one button being blue. It basically goes back to the last page you were on.
This is because the cookies aren’t getting cleared.
In fact, I am not clearing the cookies because I am stuck with what to do.
Basically, the site will be flash and php. The flash aspect will be a menu that navigate to the php pages. The php will provide the content for that page (seo work is important).
Whats cool about this is after the swf refreshes itself by going to the next page… it remembers which button should be active. Thats the whole point of this heh.
Here’s the code for the file. Please help.
stop();
var flashCookie:SharedObject = SharedObject.getLocal("flashCookie");
if (flashCookie.size == 0)
{
// Doesn't exist, create
flashCookie.data.buttonState = 0;
}
ChangeButtonState();
function ChangeButtonState()
{
HomeButton.gotoAndStop(1);
AboutButton.gotoAndStop(1);
InfoButton.gotoAndStop(1);
switch (flashCookie.data.buttonState)
{
case 0:
HomeButton.gotoAndStop(2);
break;
case 1:
AboutButton.gotoAndStop(2);
break;
case 2:
InfoButton.gotoAndStop(2);
break;
default:
break;
}
}
HomeButton.onPress = function()
{
flashCookie.data.buttonState = 0;
ChangeButtonState();
getURL("index.php");
}
HomeButton.onRollOver = function()
{
HomeButton.gotoAndStop(2);
}
HomeButton.onRollOut = function()
{
ChangeButtonState();
}
AboutButton.onPress = function()
{
flashCookie.data.buttonState = 1;
ChangeButtonState();
getURL("about.php");
}
AboutButton.onRollOver = function()
{
AboutButton.gotoAndStop(2);
}
AboutButton.onRollOut = function()
{
ChangeButtonState();
}
InfoButton.onPress = function()
{
flashCookie.data.buttonState = 2;
ChangeButtonState();
getURL("info.php");
}
InfoButton.onRollOver = function()
{
InfoButton.gotoAndStop(2);
}
InfoButton.onRollOut = function()
{
ChangeButtonState();
}
Mouse.addListener(HomeButton);
Mouse.addListener(AboutButton);
Mouse.addListener(InfoButton);