Hello
I have made a simpel text menu. The buttons are being created from an array and then placed on the stage by looping through. It all works just fint, but i dont want the user to be able to click twice at a link. I want to disable the link after clicken. I am totally lost so it would be nice if some one could help!
This is my code for the menu.
public function addMenuTxt() {
var _menuItem:Array = new Array("WEB","DIGITAL ART","3D MODELING","IDENTITY","PRINT");
var currentWidth:int = 30;
var spacing:int = 30;
var activeBtn:Number;
_txtFormat = new TextFormat();
_txtFormat.font = "Univers LT 57 Condensed";
_txtFormat.color = 0xFFFFFF;
_txtFormat.size = 11;
for (var i=0; i<_menuItem.length; i++) {
var item = _menuItem*;
trace(i);
_menu = new MovieClip();
_txt = new TextField();
_txt.selectable = false;
_txt.embedFonts = true;
_txt.antiAliasType = AntiAliasType.ADVANCED;
_menu.addChild(_txt);
_txt.defaultTextFormat = _txtFormat;
_txt.autoSize = TextFieldAutoSize.LEFT;
_txt.text = item;
_menu.addChild(_txt);
_menu.data = item;
_menu.x = currentWidth;
currentWidth += _menu.width + spacing;
_menu.y = 161;
_menu.alpha = 0;
addChild(_menu);
_menu.mouseChildren = false;
var interval = i*0.2;
TweenLite.to(_menu, 1, {alpha:1, delay:interval});
_menu.addEventListener(MouseEvent.CLICK, onClick);
_menu.addEventListener(MouseEvent.ROLL_OUT, onOut);
_menu.addEventListener(MouseEvent.ROLL_OVER, onOver);
_menu.buttonMode = true;
}
}
public function onClick(evt:MouseEvent){
menuString=evt.target.data;
var _contentLoader:contentLoader = new contentLoader(menuString);
addChild(_contentLoader);
}
public function onOut(evt:MouseEvent) {
TweenFilterLite.to(evt.target, 0.4, {colorMatrixFilter:{color: 0xFFFFFF}});
}
public function onOver(evt:MouseEvent) {
TweenFilterLite.to(evt.target, 0.4, {colorMatrixFilter:{color: 0x00dadd}});
}