Click to See Complete Forum and Search --> : menu with memory (flash actionscript / php)


domuk
01-29-2005, 01:14 PM
Hi all,

I am trying to produce a flash menu that identifies what url you have entered on and highlights the corresponding menu option (in this case _alpha, "50")

The menu is built up using multiple buttons (gallery and home).
Both the home page and the gallery page have the same swf file as their menu.
I would like the menu to recognise what url it is on and alter the colour of the button (to signify to the user that they are on that page).

I am new to actionscript and have managed to display the location in a textbox but not change the colour of the buttons.

The menu swf reloads with each html page.

Hope you can help,

Dominic


FRAME 1 actionscript

stop();

function change_colour(x)
{
if (x = home)
{
setProperty("home", _alpha, "50");
}

else if (x = gallery)
{
setProperty("gallery", _alpha, "50");
}

}


//=================================
//
// FLASH TO PHP
//=================================

gallery.onRelease = function() //gallery button

{
lvOut.flash_to_php = "gallery";
lvOut.sendAndLoad(path + "menu_location_1.php", lvIn, "POST");
};


home.onRelease = function() //home button
{
lvOut.flash_to_php = "home";
lvOut.sendAndLoad(path + "menu_location_1.php", lvIn, "POST");
};


//=================================
// PHP to FLASH
//=================================

path = "../php/"; // declare path to php files

lvOut = new LoadVars(); //create lvout object, these objects tell flash what to do if the load is successful
lvIn = new LoadVars(); //create lvin object

lvIn.onLoad = function (success)
{
if(success)
{
output_text.text = lvIn.returnVal; // there was a text box (for testing) but I have removed it from the stage
change_colour(lvIn.returnVal);
}

else
{
output_text.text = "fail";
}


}


PHP FILE menu_location_1.php

<?
$menu_location_php= $_POST['flash_to_php'];
echo "&returnVal=$menu_location_php";
?>

soccer362001
01-29-2005, 01:22 PM
When I have menu in Flash, I use different frames for the different colors. Ill go see if i can find the action script I used.

PeOfEo
01-30-2005, 12:20 AM
Using flash for navigation is a recipe for inaccessibility. I suggest a text based backup menu for those on nongraphical browsers / those without flash.

domuk
01-30-2005, 02:38 AM
Thanks,

I have got a text based menu at the bottom of the page that duplicates the flash menu. It is for this reason that I want the flash menu to know which URL you are on and change only that menus colour.

I need this so the flash menu doesn't get lost, if someone is using the text menu or if someone enters at an undisclosed URL.

I also need a text based menu so Google can crawl through my site.

You have sound advice.