0

我很难解决绝对/相对路径问题。

当使用 as3 并通过 swf 对象 JS 嵌入我的 swf 时,传输到 embed JS 函数的参数之一是“base= http://www.mydomain.com ”,它需要将外部小部件加载到应用程序中。

现在,我还加载了诸如 Styles.swf 等本地放置在客户端的外部资产,当我尝试加载这些资产时,我得到了在http://www.mydomain.com/中找不到的错误。

例如:

StyleManager.loadStyleDeclarations("Styles.swf");

错误:

can't load http://www.mydomain.com/Styles.swf

是否有可能以某种方式将 Styles.swf 作为本地资产加载???我试过用

StyleManager.loadStyleDeclarations("../Styles.swf");
StyleManager.loadStyleDeclarations("./Styles.swf");
StyleManager.loadStyleDeclarations("/Styles.swf");

但它们都不起作用......

谢谢

4

1 回答 1

1

If the base is http://www.mydomain.com, I think you're stuck with that (so relative URLs are relative to that location).

You can get the current SWF URL to through Application.url to resolve your URL directly (also see references to ExternalInterface and BrowserManager in this SO question).

于 2010-01-19T18:22:15.990 回答