Hi,
i’m AS3 newbie here.
write longer script for sometimes already and thinking is it got a way to simplify the code that i’m using.
can anyone help me simplify this?
stop();
import com.greensock.*;
import com.greensock.easing.*;
var newContent1:content_tab1 = new content_tab1();
loaderMC.addChild(newContent1);
TweenMax.from(loaderMC, 0.5, {alpha:0, ease:Expo.easeOut});
monthlyBTN.addEventListener(MouseEvent.CLICK,monthClickHandler);
monthlyBTN.buttonMode=true;
weeklyBTN.addEventListener(MouseEvent.CLICK,weekClickHandler);
weeklyBTN.buttonMode=true;
grandBTN.addEventListener(MouseEvent.CLICK,grandClickHandler);
grandBTN.buttonMode=true;
function monthClickHandler(e : Event):void {
var newContent1:content_tab1 = new content_tab1();
loaderMC.addChild(newContent1);
TweenMax.from(loaderMC, 0.5, {alpha:1, ease:Expo.easeOut});
}
function weekClickHandler(e : Event):void {
var newContent2:content_tab2 = new content_tab2();
loaderMC.addChild(newContent2);
}
function grandClickHandler(e : Event):void {
var newContent3:content_tab3 = new content_tab3();
loaderMC.addChild(newContent3);
}
addEventListener(Event.ENTER_FRAME,disableClick);
function disableClick(event:Event) {
if (loaderMC.addChild(newContent1)) {
monthlyBTN.enabled=false;
weeklyBTN.enabled=true;
grandBTN.enabled=true;
}
if (loaderMC.addChild(newContent2)) {
monthlyBTN.enabled=true;
weeklyBTN.enabled=false;
grandBTN.enabled=true;
}
if (loaderMC.addChild(newContent3)) {
monthlyBTN.enabled=true;
weeklyBTN.enabled=true;
grandBTN.enabled=false;
}
}