Multiple buttons + same function

b1.addEventListener(MouseEvent.CLICK,goto2);
b2.addEventListener(MouseEvent.CLICK, goto2);

function goto2(event:MouseEvent):void{

if(event.target.name == b1)
{
nextFrame();
}
if(event.target.name == b2)
{
prevFrame();
}
}

wats wrong with the code?

if i put 1 function for 1 button.it works fine… i try to implement the one above… it loads… no problem or anything…but it wont work :frowning: