Can the if/else statement help?

I have two buttons on the root level that share the same animation movie clip when pressed, at the end of the animation I need the actionscript in the last frame to identify which button had been pressed so it can then be directed to the appropriate root level frame for that button.

Can I achieve this with the if/else statement?, if so can someone show me how that would need be written.

As always, many thanks for your help