Calling function problem

hi, i have 8 buttons and when I press on one of them it loads a movie, what I want to do is when I press another button it loads another movie, but it must depend if there´s been another movie loaded before.

example: i have 8 buttons: instance names; btn1, btn2…btn8
and when i press btn1 it loads btn1.swf, but if I press btn2 it should load btn1-back.swf and btn2.swf…and if I press btn3, it should load btn2-back.swf and btn3.swf…but it depends on what button was pressed before…the problem is how to do that with the 8 buttons?, i think i should use a function, but I dunno how to connect the buttons …any idea???