Multiple Buttons - One Function - Different Addchilds

Hello everyone,

Here’s my dilemma - I have two buttons (home and contact) (and two pages) and I want to send them to the same function. In the function I have a pagecontainer.addChild() but I want the function to know which button I clicked and add the correct page. I have no errors in the output window but the contact page keeps tweening in even if I click the home button. Thanks for any help in advance.

the code I have:

var home:home_page = new home_page;
var contact:contact_page = new contact_page;

var pageIntroTween:Tween = new Tween(pageContainer_mc, “y”, Elastic.easeOut, 500, 100, 2, true);

var BtnArray:Array =[“home_btn”, “contact_btn”];

for each (var _btn in BtnArray) {
addEventListener(MouseEvent.CLICK, onBtnClick);

function onBtnClick (event:MouseEvent):void
var Outro:Tween = new Tween(pageContainer_mc, “x”, Back.easeIn, pageContainer_mc.x, -500, 1, true);
Outro.addEventListener(TweenEvent.MOTION_FINISH, runTransition);

function runTransition (event:TweenEvent):void

if(_btn in BtnArray == “home_btn”){
var Intro:Tween = new Tween(pageContainer_mc, “x”, Strong.easeOut, pageContainer_mc.x=500, 250, 1, true);