简体   繁体   English

动态RSL URL。 可能吗?

[英]Dynamic RSL URLs. Is it possible?

Ok, so here's my problem. 好的,所以这是我的问题。 I have several SWFs pulled in at runtime from different domains (we're using a CDN). 我在运行时从不同的域中引入了几个SWF(我们正在使用CDN)。 There are some shared fonts within the SWFs. SWF中有一些共享字体。

I'm trying to minimize file sizes as much as possible, so that means either not embedding the fonts in any of those SWFs and setting all their TextFormats at runtime. 我正在尝试尽可能地减小文件大小,这意味着要么不在任何这些SWF中嵌入字体,要么在运行时设置所有TextFormats。 That's very impractical, and it would be easy to miss some of them. 这是非常不切实际的,很容易错过其中一些。

The other, better option is to use runtime shared libraries to pull in the fonts, but that requires either an absolute URL (goes against the concept of using a CDN), or a relative URL (defeats the purpose of using RSLs in the first place since those resources would be downloaded several times anyway). 另一个更好的选择是使用运行时共享库​​来提取字体,但这需要绝对URL(违背使用CDN的概念)或相对URL(首先要破坏使用RSL的目的)因为无论如何都会多次下载这些资源)。

Ideally i'd like to be able to tell each SWF at runtime where to pull in the fonts, and give them all the same, dynamic URL. 理想情况下,我希望能够在运行时告诉每个SWF在哪里提取字体,并为它们提供所有相同的动态URL。

I can't find anyone who's encountered a similar situation, so i'm not sure if this can or can't be done, but most AS3 problems i find are solved here, so i'm hoping someone knows a good solution for this. 我找不到遇到类似情况的人,所以我不确定这是否可以做到,但我找到的大多数AS3问题都在这里得到解决,所以我希望有人知道这个问题的一个很好的解决方案。

Or is there a 3rd option i'm not considering? 或者我有没有考虑第三种选择?

We had this exact problem and finally came up with a solution. 我们遇到了这个问题,最后想出了一个解决方案。 It's not pretty but it will work. 它不漂亮但它会起作用。 The basic idea is that when you upload your files, you ignore the RSL and replace it with a blank swf, and instead manually load the contents of the RSL from a dynamic swf. 基本思想是,当您上传文件时,忽略RSL并将其替换为空白swf,而是从动态swf手动加载RSL的内容。

I posted about how we solved it here: http://blog.bluemammothgames.com/2010/10/runtime-shared-libraries-preload-and.html 我在这里发布了关于我们如何解决它的信息: http//blog.bluemammothgames.com/2010/10/runtime-shared-libraries-preload-and.html

If you have any questions, feel free to ping me here or there. 如果您有任何疑问,请随时与我联系。 As far as I understand, there is no clean way to do it, but this hack works. 据我所知,没有干净的方法可以做到这一点,但这个黑客行之有效。

是的,你有这样的选择,读这个

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

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