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";
?>
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";
?>