Allora, ho fatto così:
Prima dichiaro:
codice:
var sezatt = "home"; // la "sezione attiva" sarà home
var sezina = ""; // la "sezione in apertura" per il momento è vuota
e poi
codice:
function storiaclick(event:MouseEvent):void{
sezina = "storia";
aprichiudi(); // chiamo la funzione aprichiudi
}
function aprichiudi():void{
TweenLite.to(frame, 0.8, {alpha:0,x:61.5, y:393.0, width:13.1, height:378.0});
switch(sezatt){ // verifico qual'era la sezione attiva e faccio sparire gli elementi della sezione
case "home":
TweenLite.to(fotohome, 0.4, {alpha:0,rotation:-45});
TweenLite.to(testohome, 0.4, {alpha:0});
break;
case "storia":
TweenLite.to(fotostoria, 0.4, {alpha:0,rotation:-45});
TweenLite.to(testostoria, 0.4, {alpha:0});
break;
}
TweenLite.to(frame, 0.8, {alpha:1,x:447.9, y:393.0, width:786.0, height:378.0, delay:0.8});
switch(sezina){ // verifico qual'è la sezione in attivazione e faccio comparire gli elementi della sezione
case "home":
TweenLite.to(fotohome, 0.4, {alpha:1,rotation:0, delay:1});
TweenLite.to(testohome, 0.4, {alpha:1, delay:1.2});
sezatt="home";
break;
case "storia":
TweenLite.to(fotostoria, 0.4, {alpha:1,rotation:0, delay:1});
sezatt="storia";
break;
}
}