从互联网加载时 BulkLoader 行为发生变化

发布于 2024-12-27 20:10:47 字数 301 浏览 0 评论 0原文

我正在使用 BulkLoader 将图像、SWF、XML 等加载到游戏中。

在本地工作时,LoadingItem 上的 content 属性始终有效,具体取决于资源类型:Bitmap(如果是图像),MovieClip 如果它是 SWF 等。

当我在本地主机或在线测试相同的 swf 时,content 属性始终是 Loader 对象。

这是正常的吗?我是否遗漏了某个参数或其他内容?

I'm using BulkLoader to load in images, SWFs, XML, etc into a game.

When working local, the content property on the LoadingItem is always good depending on the type of asset: Bitmap if it's an image, MovieClip if it's a SWF etc.

When I test the same swf, but under localhost, or online, the content property is always a Loader object.

Is this normal? Am I missing out a parameter or something?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

你另情深 2025-01-03 20:10:47

好的,对于那些有同样问题的人 - ImageLoader,第 57 行:

override public function onCompleteHandler(evt : Event) : void {
    try{
        // of no crossdomain has allowed this operation, this might
        // raise a security error
        _content = loader.content;
        super.onCompleteHandler(evt);
    }catch(e : SecurityError){
        // we can still use the Loader object (no dice for accessing it as data
        // though. Oh boy:
        _content = loader;
        super.onCompleteHandler(evt);
        // I am really unsure whether I should throw this event
        // it would be nice, but simply delegating the error handling to user's code 
        // seems cleaner (and it also mimics the Standar API behaviour on this respect)
        //onSecurityErrorHandler(e);
    }

};

基本上发生的事情是发生了 SecurityError (尽管默默地),这将设置 content 属性到 Loader 而不是 Loader.content

通过在加载之前添加 Security.loadPolicyFile() 修复了该问题。

OK, for those that have the same problem - ImageLoader, line 57:

override public function onCompleteHandler(evt : Event) : void {
    try{
        // of no crossdomain has allowed this operation, this might
        // raise a security error
        _content = loader.content;
        super.onCompleteHandler(evt);
    }catch(e : SecurityError){
        // we can still use the Loader object (no dice for accessing it as data
        // though. Oh boy:
        _content = loader;
        super.onCompleteHandler(evt);
        // I am really unsure whether I should throw this event
        // it would be nice, but simply delegating the error handling to user's code 
        // seems cleaner (and it also mimics the Standar API behaviour on this respect)
        //onSecurityErrorHandler(e);
    }

};

Basically what was happening was that a SecurityError was occurring (though silently), which would set the content property to the Loader and not the Loader.content.

It was fixed with adding a Security.loadPolicyFile() before loading.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文