Code:
import gs.TweenLite;
btn06.addEventListener(MouseEvent.CLICK,f2);
function f2(e:Event){
navigateToURL(new URLRequest("http://www.jmoneyaudio.com/"), "_self");
}
//first we're making sure none of your content windows are
//being displayed when the movie launches
window01.alpha=window02.alpha=window03.alpha=window04.alpha=window05.alpha=pwindow01.alpha=pwindow02.alpha=pwindow03.alpha=0;
//this doesn't change: just listening for mouse clicks
addEventListener(MouseEvent.CLICK,onClick,false,0,true);
//this changes a bit. Rather than dealing with the visible
//property of the windows, we'll be tweening alpha properties
var isTweening:Boolean=false;
function resetBool():void {
isTweening=false;
}
function onClick(e:MouseEvent):void {
if (!isTweening) {
isTweening=true;
switch (e.target) {
case btn01 :
closeWindows();
TweenLite.to(window01,1,{alpha:1,overwrite:false,onComplete:resetBool});//this is a call to
//the TweenLite class you set up earlier: The first parameter is the
//display object you're targeting (window0x), the second param is
//length of time the tween will take to complete in whole seconds
//(1 second), then all properties for the display object are listed in
//the third param within {}, in this case we're changing the alpha
//from 0 to 1 and we don't want this tween call to interrupt/overwrite
//any previous tween calls
break;
case btn02 :
closeWindows();
TweenLite.to(window02,1,{alpha:1,overwrite:false,onComplete:resetBool});
break;
case btn03 :
closeWindows();
TweenLite.to(window03,1,{alpha:1,overwrite:false,onComplete:resetBool});
break;
case btn04 :
closeWindows();
TweenLite.to(window04,1,{alpha:1,overwrite:false,onComplete:resetBool});
break;
case btn05 :
closeWindows();
TweenLite.to(window05,1,{alpha:1,overwrite:false,onComplete:resetBool});
break;
case window01.pbtn01 :
closeWindows();
TweenLite.to(pwindow01,1,{alpha:1,overwrite:false,onComplete:resetBool});
break;
case window01.pbtn02 :
closeWindows();
TweenLite.to(pwindow02,1,{alpha:1,overwrite:false,onComplete:resetBool});
break;
case window01.pbtn03 :
closeWindows();
TweenLite.to(pwindow03,1,{alpha:1,overwrite:false,onComplete:resetBool});
break;
default :
return;
}
}
}
function closeWindows():void{
//for each of these ifs we're looking for the object that is currently
//being displayed (we know this because it's alpha will be equal to 1)
//and then tweening its alpha property down to 0 over 1 second
if(window01.alpha==1) TweenLite.to(window01,1,{alpha:0});
else if(window02.alpha==1) TweenLite.to(window02,1,{alpha:0});
else if(window03.alpha==1) TweenLite.to(window03,1,{alpha:0});
else if(window04.alpha==1) TweenLite.to(window04,1,{alpha:0});
else if(window05.alpha==1) TweenLite.to(window05,1,{alpha:0});
else if(pwindow01.alpha==1) TweenLite.to(pwindow01,1,{alpha:0});
else if(pwindow02.alpha==1) TweenLite.to(pwindow02,1,{alpha:0});
else if(pwindow03.alpha==1) TweenLite.to(pwindow03,1,{alpha:0});
}
//BTN STUFF!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
btn01.alpha=.60;
btn02.alpha=.60;
btn03.alpha=.60;
btn04.alpha=.60;
btn05.alpha=.60;
btn06.alpha=.60;
window01.pbtn01.alpha=.60;
window01.pbtn02.alpha=.60;
window01.pbtn03.alpha=.60;
btn01.addEventListener(MouseEvent.MOUSE_OVER,onBtnOver,false,0,true);
btn01.addEventListener(MouseEvent.MOUSE_OUT,onBtnOut,false,0,true);
btn02.addEventListener(MouseEvent.MOUSE_OVER,onBtnOver,false,0,true);
btn02.addEventListener(MouseEvent.MOUSE_OUT,onBtnOut,false,0,true);
btn03.addEventListener(MouseEvent.MOUSE_OVER,onBtnOver,false,0,true);
btn03.addEventListener(MouseEvent.MOUSE_OUT,onBtnOut,false,0,true);
btn04.addEventListener(MouseEvent.MOUSE_OVER,onBtnOver,false,0,true);
btn04.addEventListener(MouseEvent.MOUSE_OUT,onBtnOut,false,0,true);
btn05.addEventListener(MouseEvent.MOUSE_OVER,onBtnOver,false,0,true);
btn05.addEventListener(MouseEvent.MOUSE_OUT,onBtnOut,false,0,true);
btn06.addEventListener(MouseEvent.MOUSE_OVER,onBtnOver,false,0,true);
btn06.addEventListener(MouseEvent.MOUSE_OUT,onBtnOut,false,0,true);
window01.pbtn01.addEventListener(MouseEvent.MOUSE_OVER,onBtnOver,false,0,true);
window01.pbtn01.addEventListener(MouseEvent.MOUSE_OUT,onBtnOut,false,0,true);
window01.pbtn02.addEventListener(MouseEvent.MOUSE_OVER,onBtnOver,false,0,true);
window01.pbtn02.addEventListener(MouseEvent.MOUSE_OUT,onBtnOut,false,0,true);
window01.pbtn03.addEventListener(MouseEvent.MOUSE_OVER,onBtnOver,false,0,true);
window01.pbtn03.addEventListener(MouseEvent.MOUSE_OUT,onBtnOut,false,0,true);
function onBtnOver(e:MouseEvent):void{
TweenLite.to(e.target, 0.8, {alpha:1});
}
function onBtnOut(e:MouseEvent):void{
TweenLite.to(e.target, 0.8, {alpha:0.6});
}