Button action dependent on condition

here’s the scenario:

I want a button to have different actions (such as launching different URLs) depending on which current external swf is loaded. I figure I need to use if statements coupled with variables assigned by the swfs, but I’m just not sure how to do it. Could anyone please help this actionscript newbie out?

It’s quite easy to do.

When a certain swf loads have a variable for example “whichsite” set to a certain number. And on the button action, as you said, have an if statement - which checks what numner “whichsite” is and if it’s a certain one - go to a certain URL.

Or have a the variable “whichsite” store the actual name of the URL, so when for example 1.swf loads, have “http://www.blah.com” put into the variable “whichsite”:

whichsite = “http://www.blah.com”;

So when the button is pressed use: