ActionScript 3 - 支持许多应用程序的加载程序?
我在 ActionScript 3.0 中创建了一个简单的 SWF 加载器。它从服务器加载 SWF,然后播放它。下载时,会显示“正在加载”屏幕。
它的主要缺陷是它只能加载一个 Flash 应用程序 - 为其编译的应用程序。假设它的名称为 test1.swf。
有没有办法让加载器支持多个Flash应用程序(例如test2.swf和test3.swf)?我的意思是通过向其传递外部参数,而不是通过创建另一个加载器。使用 Javascript 是唯一的方法吗?我不希望我的加载程序需要 Javascript 支持。
我真的不想为我的所有应用程序创建单独的加载器......
提前致谢。
I have created a simple SWF-loader in ActionScript 3.0. It loads an SWF from a server and then plays it. While downloading, it displays the "loading" screen.
Its main defect is that it can load only one Flash application - the one which it is compiled for. Let's say it's named test1.swf.
Is there any way to make the loader support more than one Flash app (for example test2.swf and test3.swf)? I mean by passing external parameters to it and not by creating another loader. Is using Javascript the only way to do it? I don't want my loader to require the Javascript support.
And I really don't want to create separate loaders for all of my apps...
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为了加载外部 SWF,您的加载器只需要加载 swf 的 url,该 url 不必进行硬编码。将参数传递到 SWF 文件的方法有很多种,但不一定需要 JavaScript。
例如,您可以加载 XML 文件,简单的文本文件也可以,您还可以使用 PHP 脚本。使用 flahsvars 需要 Javascript,尽管只是为了在 HTML 页面中设置应用程序。
在下面的示例中,您的应用程序不需要重新编译,您只需更改文本文件中的 url 即可。
In order to load an external SWF your loader only need the url of the swf to be loaded, this url doesn't have to be hardcoded. There are many ways to pass parameters to a SWF file and they don't necessarily require Javascript.
You could load a XML file for instance, a simple text file would work too , you could also use a PHP script. Using flahsvars would require Javascript, although only to set your application in your HTML page.
With the following example , your app doesn't need to recompile , you simply change the url in the text file.