如何在 Actionscript3 中加载预加载器?

发布于 2024-07-26 14:56:35 字数 254 浏览 2 评论 0原文

我想通过 Loader 将预加载器(称为“目标应用程序”)加载到我自己的 Flash 应用程序(称为“托管应用程序”)中。 目标应用程序像典型的预加载器一样通过相对路径加载其他几个 SWF 文件并启动目标应用程序。

如果托管应用程序和目标应用程序位于同一目录中,则一切正常。 如果情况相反(目标应用程序与托管应用程序不在同一目录中),则目标应用程序无法找到它必须加载的 SWF 文件。

有没有办法告诉目标应用程序它应该使用自己的目录作为工作目录?

I want to load a preloader (call it "target app") into my own Flash application (call it "hosting app") via Loader. The target app loads like a typical preloader several other SWF files via relative paths and starts the target app.

If the hosting app and the target app are residing in the same directory everything works fine. If the opposite is the case (target app not in the same directory as hosting app) the target app is not able to find the SWF files it has to load.

Is there a way to tell the target app it should use its own directory as working directory?

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

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

发布评论

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

评论(1

优雅的叶子 2024-08-02 14:56:35

相对 URL 是根据 VM 上的第一个 swf 进行解析的。

为了改变这一点,你有两个选择:
1. 在目标应用程序上使用 loaderInfor.url,并连接该基本路径中的其他 URL。
2. 在 loaderInfo 上设置“base”参数(在 swf 完成加载之前,初始化之后)。 我不确定这是否适用于加载的 swf(原则上应该如此)

这样,您可以确保所有 URL 都相对于目标 swf 进行解析。

干杯

Relative URLs are resolved in relation to the first swf on the VM.

In order to change that, you'd have two options:
1. use loaderInfor.url on the target app, and concatenate other URLS from that base path.
2. Set the "base" parameters on the loaderInfo (before the swf finishes loading, just after init). I am not sure this works on a loaded swf (it should, in principle)

This way, you can be sure that all URLs are resolved relative to the target swf.

Cheers

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