使用AS3条件中的当前浏览器URL

时间:2015-04-20 17:46:04

标签: actionscript-3 flash conditional-statements

我是ActionScript中的新手,我想知道是否有办法使用我的SWF嵌入的页面URL来使用一些if条件。我的SWF是一个交互式菜单,它将位于不同的页面中,并且需要根据用户所在的页面执行特定操作。

我在考虑一些条件:

    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)
  }

有没有办法存档这样的东西?

1 个答案:

答案 0 :(得分:1)

使用ExternalInterface:

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