如何找到嵌入Flash文件的页面的URL

发布于 2024-09-08 02:52:09 字数 221 浏览 4 评论 0原文

我正在 Flex Builder 3 中编写 Flash 应用程序。 我有一个问题。我需要嵌入 Flash 应用程序的位置的 URL。

mx.core.Application.application.url

这给了我原始 swf 文件的地址,但我实际上需要嵌入此 SWF 的 HTML 文件的 URL。 有办法吗??? 谢谢! 阿里

I am writing a Flash app in Flex Builder 3.
I have a problem. I need the URL of the place where the Flash app has been embedded.

mx.core.Application.application.url

This gives me the address of the original swf file, but I actually need the URL of the HTML file where this SWF has been embedded.
is there a way ???
thanks!
Ali

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

念三年u 2024-09-15 02:52:09

你有两个选择。
在 flex:

private function initApp():void {
        browserManager = BrowserManager.getInstance();
        browserManager.addEventListener(BrowserChangeEvent.URL_CHANGE, showURLDetails);            
        browserManager.init("", "Welcome!");            
    }

和侦听器中

        private function showURLDetails(e:BrowserChangeEvent):void {
        var url:String = browserManager.url;
        baseURL = browserManager.base;
        fragment = browserManager.fragment;                
        previousURL = e.lastURL;                

        fullURL = mx.utils.URLUtil.getFullURL(url, url);
        port = mx.utils.URLUtil.getPort(url);
        protocol = mx.utils.URLUtil.getProtocol(url);
        serverName = mx.utils.URLUtil.getServerName(url);
        isSecure = mx.utils.URLUtil.isHttpsURL(url);        
    }

该代码既可以在服务器上也可以在本地主机上运行。

如果这对你不起作用(首先在此处上传错误),但你也可以创建一个 JS 函数,该函数将返回 URL 并让 Flex 调用此函数。

You have 2 options.
in flex:

private function initApp():void {
        browserManager = BrowserManager.getInstance();
        browserManager.addEventListener(BrowserChangeEvent.URL_CHANGE, showURLDetails);            
        browserManager.init("", "Welcome!");            
    }

and the listener

        private function showURLDetails(e:BrowserChangeEvent):void {
        var url:String = browserManager.url;
        baseURL = browserManager.base;
        fragment = browserManager.fragment;                
        previousURL = e.lastURL;                

        fullURL = mx.utils.URLUtil.getFullURL(url, url);
        port = mx.utils.URLUtil.getPort(url);
        protocol = mx.utils.URLUtil.getProtocol(url);
        serverName = mx.utils.URLUtil.getServerName(url);
        isSecure = mx.utils.URLUtil.isHttpsURL(url);        
    }

That code works both on the server and on Local host.

if that does not work for you (upload the error here first) but you can also create a JS function that will return the URL and have flex call this function.

戏舞 2024-09-15 02:52:09

我的评论不可读,所以这里作为答案。

当涉及到浏览器管理器时,SWFObject 内部的代码使 flash 表现得有点古怪。
解决方案位于history.js 中(如果没有,请首先将其附加到HTML)

然后,注释掉这些代码行。

if (players.length == 0 || players[0].object == null) {
var tmp = document.getElementsByTagName(‘embed’);
players = tmp;
}

而这个

if (player == null || player.object == null) {
    player = document.getElementsByTagName(‘embed’)[0];
    }

应该可以解决你的问题。

my comment is unreadable so here it is as an answer.

The code inside SWFObject makes flash act alittle wacky when it comes to the browser manager.
the solution is inside history.js (first attach it to the HTML if you didn't)

Then, comment out these lines of code.

if (players.length == 0 || players[0].object == null) {
var tmp = document.getElementsByTagName(‘embed’);
players = tmp;
}

And this one

if (player == null || player.object == null) {
    player = document.getElementsByTagName(‘embed’)[0];
    }

This should solve your problem.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文