Hi, I have two buttons.If U click one button it tint's. The problem is that I want to remove the tint from the first(home) button if I click the other button...any pointers?
import com.greensock.plugins.*;
import com.greensock.*;
import com.greensock.easing.*;
TweenPlugin.activate([TintPlugin]);
//Array to hold all the button instances.
var buttonArr:Array = new Array(home_btn,oferta_btn);
//Loop through all the button instance using the ‘for loop’.
for (var i =0; i < buttonArr.length; i++) {
buttonArr[i].addEventListener(MouseEvent.CLICK, tint);
buttonArr[i].addEventListener(MouseEvent.MOUSE_DOWN, noTint);
buttonArr[i].buttonMode = true;
}
//Function to create effect.
function tint(event:MouseEvent):void {
TweenLite.to(event.currentTarget, 1, {tint:0xff0000, ease:Expo.easeIn});
}
//Function to remove effect.
function noTint(event:MouseEvent):void {
TweenLite.to(event.currentTarget, 1, {removeTint:true});
}
home_btn.addEventListener(MouseEvent.CLICK,home);
oferta_btn.addEventListener(MouseEvent.CLICK,oferta);
home_btn.buttonMode = true;
oferta_btn.buttonMode = true;
// the stop action is here, and not inside the movieclip
home_btn.stop();
home_btn.addEventListener(MouseEvent.CLICK, home);
function home(evt:MouseEvent):void {
home_btn.play();
home_btn.addEventListener(Event.ENTER_FRAME, homeLink);
}
function homeLink(evt:Event):void {
if ( home_btn.currentFrame== home_btn.totalFrames) {
home_btn.gotoAndStop(1); // 'rewinds' the buton/clip back to it's original state. use frame-labels if desired
navigateToURL(new URLRequest("index.php"),"_self");
home_btn.removeEventListener(Event.ENTER_FRAME, homeLink);
}
}
oferta_btn.stop();
oferta_btn.addEventListener(MouseEvent.CLICK, oferta);
function oferta(evt:MouseEvent):void {
oferta_btn.play();
oferta_btn.addEventListener(Event.ENTER_FRAME, ofertaLink);
}
function ofertaLink(evt:Event):void {
if ( oferta_btn.currentFrame== oferta_btn.totalFrames) {
oferta_btn.gotoAndStop(1); // 'rewinds' the buton/clip back to it's original state. use frame-labels if desired
navigateToURL(new URLRequest("oferta.php"),"_self");
oferta_btn.removeEventListener(Event.ENTER_FRAME, ofertaLink);
}
}