This bit of code is from my demo city website, where there was an animation for clicking each button that also corresponded with the button going off-screen. This meant two animations were playing at once, depending on which button is currently “up” and which is coming into play. To keep track of this… booleans!

stop();
//variables
var About:Boolean = false;
var Home:Boolean = false;
var Attractions:Boolean = false;
//listener
home.addEventListener (MouseEvent.CLICK, onhomeClick);
about.addEventListener (MouseEvent.CLICK, onaboutClick);
attractions.addEventListener (MouseEvent.CLICK, onattractionsClick);
addEventListener (Event.ENTER_FRAME, EnterFramehandler);
//function
function onhomeClick (event: MouseEvent) : void {
Home = true;
About = false;
Attractions = false;
trace (“ok”);
}
function onaboutClick (event: MouseEvent) : void {
Home = false;
About = true;
Attractions = false;
}
function onattractionsClick (event: MouseEvent) : void {
Home = false;
About = false;
Attractions = true;
}
function EnterFramehandler (event:Event) : void {
if(About == true) {
about_mc.play ();
home_mc.play ();
attractions_mc.prevFrame();
About = false;
} else {
}
if(Home == true) {
home_mc.prevFrame ();
about_mc.prevFrame();
attractions_mc.prevFrame();
Home = false;
} else {
}
if(Attractions == true) {
attractions_mc.play ();
home_mc.play ();
attractions_mc.prevFrame();
Attractions = false;
} else {
}
}