简体   繁体   English

Flex:图像的条件嵌入

[英]Flex: conditional embedding of images

We are working on a flex project where we want to balance two challenges a) want to ensure that there is minimal need to be connected to internet- so it can be used offline. 我们正在一个flex项目中,我们希望平衡两个挑战:a)要确保几乎不需要连接到Internet,因此可以离线使用它。 This will be used in rural locations with flaky connections 将用于带有易断线连接的农村地区

b) Reduce file size by only embedding those assets in compile mode as is required b)通过仅根据需要以编译模式嵌入这些资产来减小文件大小

Broadly, the project will go down one of three flows in the module called, based on user choice- Path A, Path B and Path C, which will require image set-A, set-B & set-C respectively (based on settings in the module) 大致而言,该项目将根据用户选择在名为模块的三个流之一中进行选择-路径A,路径B和路径C,这将分别需要图像set-A,set-B和set-C(基于设置)在模块中)

We want to send over all images in Set-A or set-B or set-C right upfront in the module called, based on choice made in primary project, to minimize need for connectivity once accessed. 我们希望根据主项目中的选择,在所调用的模块中直接发送Set-A或set-B或set-C中的所有图像,以最大程度地减少访问后的连接需求。 At the same time I want to avoid sending all three sets and bloating up download size three times. 同时,我要避免发送全部三套文件,并使下载大小膨胀三倍。

The question is how do I conditionally embed images such that if I am going down path A, the module sent down only has images of set-A 问题是如何有条件地嵌入图像,以便如果我沿着路径A向下发送,则向下发送的模块仅具有set-A的图像

Are you compiling Flex on Fly/Runtime from primary project on server? 您是否正在从服务器上的主项目编译Fly / Runtime上的Flex?

If NO, its mean you are compiling it in IDE, in that case i suggest build 3 Application For Path-A B nd C, you dont need to rewrite whole application again just ReWrite Application.mxml for three apps and emebed rrelative assests in them 如果为“否”,则意味着您要在IDE中进行编译,在这种情况下,我建议构建3个针对Path-A B nd C的应用程序,您无需再次重写整个应用程序,只需为三个应用程序重新编写Application.mxml并在其中添加相对的资产

IF YES, same ans seprate app.mxml for each path 如果是,则每个路径都相同且分别为app.mxml

EDIT: Anotther option is conditional compilation It is To include or exclude blocks of code for certain builds, you can use conditional compilation 编辑:Anotther选项是条件编译 它是要包括或排除某些构建的代码块,您可以使用条件编译

hopes that helps 希望能有所帮助

We had to solve a similar problem with asset localization, and we ended up creating external RSLs to link in "asset packages". 我们必须解决资产本地化的类似问题,最终我们创建了外部RSL来链接“资产包”。 However, this does require a bit more attention to the build process, since you have to pay closer attention to linkage and dependencies across RSLs. 但是,这确实需要更多地关注构建过程,因为您必须更加注意跨RSL的链接和依赖性。 Most of these problems go away if all of your libraries are linked as external as apposed to merged-in-code (not just for your app, but any local libraries you may use as well). 如果将所有库都作为与合并代码相对应的外部链接进行链接,则这些问题中的大多数都会消失(不仅适用于您的应用程序,而且还可以使用任何本地库)。 This is not necessarily required, but it does help ensure everything you need gets linked in. 这不是必需的,但确实有助于确保所需的所有内容都已链接到其中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM