DDVazquez
DDVazquez

Reputation: 13

using the current browser URL in AS3 conditionals

i'm kind of new in ActionScript and i was wondering if there is a way to use the page URL my SWF in embeded in to use some if conditionals. my SWF is an interactive menu and is going to be in different pages and it needs to do specific actions depending the page the user is in.

i was thinking of some conditionals like:

    if (URL ="https://example.com/1"){
  gotoAndStop(2)
  }
  else if (URL ="https://example.com/2"){
  gotoAndStop(3)
  }
  else if (URL ="https://example.com/3"){
  gotoAndStop(4)
  }

is there a way to archive something like this?

Upvotes: 0

Views: 36

Answers (1)

Daniil Subbotin
Daniil Subbotin

Reputation: 6708

Use ExternalInterface:

if (ExternalInterface.available)
{
    var url:String = ExternalInterface.call("window.location.href.toString");
    if (url == "https://...
}

Upvotes: 1

Related Questions