构建具有相同功能但跨多个类别的不同资源的应用程序
我正在更新一个 Flex 应用程序,该应用程序在各种类别(即棒球、篮球、足球)中具有相同的功能,但在加载时只需要访问一个类别的资源(~400kb 图像) 。 我需要将每个类别的资源分开,以便它只加载其需要的资源,以节省带宽并缩短最终用户的加载时间。
我研究过 ResourceBundle,但它似乎最适合语言环境。
您建议如何为此类项目设置架构,以减少最终用户在加载时只需要将其用于一个类别的文件大小? 我可以使用 Flex/ActionScript 中的哪些工具来执行此操作?
I am updating a Flex application which has the same functionality across a variety of categories (i.e. Baseball, Basketball, Football), but only needs access to the resources (~400kb images) of one category when it loads. I need to separate out the resources for each category so it only loads the ones its needs in order to save bandwidth and shorten load time for the end-user.
I've looked into ResourceBundle, but it seems best suited to locales.
How do you recommend setting up the architecture for such a project to reduce file-size for the end user who only needs to use it for one category when it loads? What tools within Flex/ActionScript can I use to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以将一些资源嵌入到不同的样式表中,将它们分别编译为单独的 SWF,然后使用 StyleManager 在运行时动态加载每个 SWF。 Flex 文档的此页面显示了如何处理运行时样式表:
http ://livedocs.adobe.com/flex/3/html/styles_10.html#284678
您可能还想阅读整章以获取其他背景信息:
http://livedocs.adobe.com/flex/3/html/styles_01.html
You can embed some of your resources into a different stylesheet, compile them each to a separate SWF and then use the StyleManager to load each SWF dynamically at runtime. This page of the Flex docs shows how to deal with runtime style sheets:
http://livedocs.adobe.com/flex/3/html/styles_10.html#284678
You may also want to read the entire chapter as well for additional background info:
http://livedocs.adobe.com/flex/3/html/styles_01.html
处理此类问题的常用方法是拥有一组 XML 文件,一个主文件,一个用于每个类别。 主 XML 将枚举类别以及在哪里可以找到每个类别的 XML 文件。 然后,每个类别 XML 文件将描述该类别的所有资产。
A common method for handling something like this is to have a set of XML files, one master and one for each category. The master XML will enumerate the categories and where to find the XML files for each of the categories. Then, each category XML file would describe all of the assets for that category.
后来,我意识到 Flex 有模块,我可以使用它在运行时将组件加载到我的应用程序中。 请在此处了解有关 Flex 3 模块的更多信息。
Later, I realized Flex had modules and that I could use then to load components into my application at runtime. Read more about Flex 3 modules here.