签署不带 Flex 的 RSL(纯 AS3 项目)
这里简单解释一下我们如何用纯AS3“模拟”Flex中使用的RSL系统: 在不使用 Flex 的情况下加载 RSL?
但是签名的 RSL 又如何呢?我们也可以使用该技术来加载 SWZ 文件吗?它们会被播放器缓存吗?我们如何在纯 AS3 项目中“重用”播放器缓存的 SWZ?
谢谢! 恩里克.
Here there's a brief explanation of how we can "simulate" the RSL system used in Flex with pure AS3:
loading an RSL without using flex?
But what about signed RSLs? can we use that technique to load SWZ files too? will them be cached by the player? how can we "reuse" a SWZ cached by the player in a pure AS3 project?
Thanks!
Enrique.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
签名的 SWC(即 SWZ)会加载到 Flash 播放器缓存中,而不是浏览器缓存中。因此,仅允许超级可信代码,目前仅来自 Adobe。
用于预加载?我知道的唯一方法并不是真正的方法,而是假设您的 Flex 应用程序之前有一个信息页面或登录页面,当用户可能正在阅读某些内容时,通过包含一个使用与主应用程序相同的 RSL 的轻量级 SWF 来加载 RSL。这是一种作弊,但在带宽最低且希望在应用程序首次加载时获得实惠时使用它。
在播放器之外以任何其他方式预加载我可以看到安全问题。
Signed SWC (ie SWZ) are loaded into the flash player cache rather than the browser cache. Therefore only uber trusted code is allowed which at the moment comes from Adobe only.
For preloading? Only way i know is not really a way, but say you have an info page or login page before your Flex app, load the RSLs when the user is maybe reading something by including a lightweight SWF that uses the same RSLs as your main app. Its a cheat, but seen it used when bandwidth is a minimum and want to get bang for buck when an app first loads.
Preloading any other way outside the player I could see security concerns with.
好的,这就是解决方案(尚未测试,但我很确定它有效)
来自 Adobe AS3 参考的示例:
//URLRequest,摘要属性:
因此,我们可以像任何其他 SWF 一样加载签名的 RSL (.SWZ),但是!我们必须使用 URLLoader,而不是 Loader,并提供摘要属性。
然后我们使用Loader从URLLoader加载byteArray。
签名的SWZ由Player内部检查,如果检测到是由adobe签名的,那么它将被Player缓存,我们不需要做任何事情。
我认为 Flash Player 在加载任何 SWZ 之前会自动检查该 SWZ 是否已被播放器缓存。
我就是这么想的。
如果您想查看更多详细信息,请查看我在 FlexCoders 中的回复:
http://tech.groups.yahoo.com/group/flexcoders/message/ 159010
OK, This is the solution (not tested yet but I'm pretty sure it works)
Example from the Adobe's AS3 Reference:
//URLRequest, digest property:
So, we can load a signed RSL (.SWZ) like any other SWF, BUT! we must use URLLoader, not Loader, and provide the digest property.
Then we use Loader to load the byteArray from URLLoader.
The signed SWZ is checked internally by the Player, and if it detects is signed by adobe, then it will be cached by the Player, we don't need to do anything.
I think Flash Player checks automatically, and before loading any SWZ, if that SWZ is already cached by the player.
That's all I think.
if you want to see more details, check my reply in FlexCoders:
http://tech.groups.yahoo.com/group/flexcoders/message/159010