加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

flash – Actionscript 3中的相对URL

发布时间:2020-12-15 07:22:21 所属栏目:百科 来源:网络整理
导读:我有一个使用Actionscript 3的flash电影,其中包含一些打开新页面链接的按钮.这是我重定向到新页面的代码: myButton.addEventListener(MouseEvent.CLICK,function(e:MounseEvent) { var request:URLRequest = new URLRequest('http://www.example.com/page2.
我有一个使用Actionscript 3的flash电影,其中包含一些打开新页面链接的按钮.这是我重定向到新页面的代码:

myButton.addEventListener(MouseEvent.CLICK,function(e:MounseEvent) {
    var request:URLRequest = new URLRequest('http://www.example.com/page2.html');
    navigateToURL(request,"_top");
});

它在我的生产服务器上运行良好,包含域名的完整URL,但当我将其更改为:

var request:URLRequest = new URLRequest('page2.html');

它不再适用于生产.我在这里错过了什么?我不想将整个URL编码到电影中.

解决方法

URLRequests是相对于包含它们的HTML文件(SWF在哪里无关紧要),因此您需要考虑到这一点.
您可以设置EMBED / OBJECT的可选属性来更改此行为,请参见此处:

base – . or [base directory] or [URL]. Specifies the base directory or
URL used to resolve all relative path
statements in the Flash Player movie.
This attribute is helpful when your
Flash Player movies are kept in a
different directory from your other
files.

http://kb2.adobe.com/cps/127/tn_12701.html

编辑:此外,尽量避免使用相对文件的绝对URL,因为您可能会收到沙箱错误,例如,加载没有“www.”的网络…

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读