Flash Button "Active" State
Hi friends,
I am trying to create a flash navigation bar for the first time and i have problems making it work the clicked state wont stick! I've looking thru tons of tutorials and only found 1 that ALMOST fits my need. Im lost in the never ending google and i really cant find the help i need to make it work so here i am.
Here goes my problem i hope someone can help me out, i am very new to flash so please consider that if you want to help me out. ![]()
I have created a navigation bar with 5 buttons made of movie clips each containing 4 states labeld up, over, out and clicked. When i test the navigationbar inside flash it works fine because it does not reload when i click a button as it would on the website where the whole page reloads. But on the website when im testing it the button state "clicked" just wont stick and i understand why, because the page is reloading and my script tells all the buttons to return to "up" state when the flash starts. But i would like them to stick... and i dont know how to do it really. I would love if there was a way to make so when i click the button the flash does not reload when im trying to grab my main content but im not sure if its possible. Or maybe so that the script checks what page i am on and activates the "clicked" state that way... Im not sure to be honest.
Here is my action script for my navigationbar. Please help me..
button1.buttonMode = true;
button2.buttonMode = true;
button3.buttonMode = true;
button4.buttonMode = true;
button5.buttonMode = true;
function allButtonsUp(): void {
button1.gotoAndStop("up");
button2.gotoAndStop("up");
button3.gotoAndStop("up");
button4.gotoAndStop("up");
button5.gotoAndStop("up");
}
function allButtonsOver(): void {
button1.addEventListener(MouseEvent.MOUSE_OVER,
overFunction);
button2.addEventListener(MouseEvent.MOUSE_OVER,
overFunction);
button3.addEventListener(MouseEvent.MOUSE_OVER,
overFunction);
button4.addEventListener(MouseEvent.MOUSE_OVER,
overFunction);
button5.addEventListener(MouseEvent.MOUSE_OVER,
overFunction);
}
function allButtonsCLICK(): void {
button1.addEventListener(MouseEvent.CLICK,
clickFunction);
button2.addEventListener(MouseEvent.CLICK,
clickFunction);
button3.addEventListener(MouseEvent.CLICK,
clickFunction);
button4.addEventListener(MouseEvent.CLICK,
clickFunction);
button5.addEventListener(MouseEvent.CLICK,
clickFunction);
}
button1.addEventListener(MouseEvent.CLICK, Home);
function Home(event: MouseEvent): void {
navigateToURL(new URLRequest("?page=home"), "_self");
}
button2.addEventListener(MouseEvent.CLICK, Register);
function Register(event: MouseEvent): void {
navigateToURL(new URLRequest("?page=register"), "_self");
}
button3.addEventListener(MouseEvent.CLICK, Ranking);
function Ranking(event: MouseEvent): void {
navigateToURL(new URLRequest("?page=ranking"), "_self");
}
button4.addEventListener(MouseEvent.CLICK, Downloads);
function Downloads(event: MouseEvent): void {
navigateToURL(new URLRequest("?page=downloads"), "_self");
}
button5.addEventListener(MouseEvent.CLICK, Donate);
function Donate(event: MouseEvent): void {
navigateToURL(new URLRequest("?page=donate"), "_self");
}
function allButtonsOut(): void {
button1.addEventListener(MouseEvent.MOUSE_OUT,
outFunction);
button2.addEventListener(MouseEvent.MOUSE_OUT,
outFunction);
button3.addEventListener(MouseEvent.MOUSE_OUT,
outFunction);
button4.addEventListener(MouseEvent.MOUSE_OUT,
outFunction);
button5.addEventListener(MouseEvent.MOUSE_OUT,
outFunction);
}
allButtonsUp();
allButtonsOver();
allButtonsCLICK();
allButtonsOut();
function overFunction(e: MouseEvent): void {
e.target.gotoAndStop("over");
}
function outFunction(e: MouseEvent): void {
e.target.gotoAndStop("up");
}
function clickFunction(e: MouseEvent): void {
allButtonsUp();
allButtonsOver();
allButtonsCLICK();
allButtonsOut();
e.target.gotoAndStop("clicked");
e.target.removeEventListener(MouseEvent.MOUSE_OVER,
overFunction);
e.target.removeEventListener(MouseEvent.MOUSE_OUT,
outFunction);
}
