Hi at all.
I have a problem wirh script below about my Menu bar.
I want each button of menu bar don’t turn back when I click it.
In others words, I want this:
- Mouse_Over, button go down;
- Mouse_Out, button go up;
- Click, the button clicked stops in down position but turn up when I click another button of menu bar.
I have tried with a “removeEventListener” but (you can verify in the .fla attached file) it don’t work.
Why? Please, can anyone help me to resolve that problem?
Thanks.
Bye,
eloisa
EDIT: Sorry, the .fla file to check is not attached. I have had problem to attache it here.
It is here now: http://file.webalice.it (my web sapace)
Please, use this user and password to enter:
username: libercoriando
pw: menubar
import fl.transitions.Tween;
import fl.transitions.easing.*;
var allHits:Array = new Array();
allHits = [hit_home, hit_about, hit_menu, hit_gallery, hit_contacts];
for(var i:Number=0; i<allHits.length; i++)
{
allHits*.addEventListener(MouseEvent.MOUSE_OVER, rollMeOver, false, 0, true);
allHits*.addEventListener(MouseEvent.MOUSE_OUT, rollMeOut, false, 0, true);
allHits*.addEventListener(MouseEvent.CLICK, clickMe, false, 0, true);
}
/* var myMenu:Array = new Array();
myMenu = [home_mc, about_mc, menu_mc, oro_mc, gallery_mc, contacts_mc]; */
//Definisco la funzione rollMeOver
function rollMeOver(e:MouseEvent):void
{
var allMenu:MovieClip;
switch (e.currentTarget.name)
{
case "hit_home":
allMenu = home_mc;
break;
case "hit_about":
allMenu = about_mc;
break;
case "hit_menu":
allMenu = menu_mc;
break;
case "hit_gallery":
allMenu = gallery_mc;
break;
case "hit_contacts":
allMenu = contacts_mc;
break;
}
new Tween(allMenu, "y", Elastic.easeOut, 10, 25, 1, true);
var colorTransform:ColorTransform = allMenu.transform.colorTransform;
colorTransform.color = 0xBFE4FF;
allMenu.transform.colorTransform = colorTransform;
}
// Definisco la funzione rollMeOut
function rollMeOut(e:MouseEvent):void
{
var allMenu:MovieClip;
switch (e.currentTarget.name)
{
case "hit_home":
allMenu = home_mc;
break;
case "hit_about":
allMenu = about_mc;
break;
case "hit_menu":
allMenu = menu_mc;
break;
case "hit_gallery":
allMenu = gallery_mc;
break;
case "hit_contacts":
allMenu = contacts_mc;
break;
}
new Tween(allMenu, "y", Elastic.easeOut, 25, 10, 1, true);
var colorTransform:ColorTransform = allMenu.transform.colorTransform;
colorTransform.color = 0xFFFFFF;
allMenu.transform.colorTransform = colorTransform;
}
//Definisco la funzione clickMe
function clickMe(e:MouseEvent):void
{
trace ("Pulsante cliccato! Grazie!");
if (e.currentTarget)
{
allHits*.removeEventListener(MouseEvent.MOUSE_OUT, rollMeOut, false, 0, true);
}
}