凯恩戈姆SequenceTask +的URLLoader抛出由于缺少用户交互引发SecurityError [英] Cairngorm SequenceTask + URLLoader throws SecurityError because of missing user interaction

查看:288
本文介绍了凯恩戈姆SequenceTask +的URLLoader抛出由于缺少用户交互引发SecurityError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让一个应用程序上传多个客户端生成的图像(而不是文件,所以我不能使用的FileReference),同时显示上传进度。这已被证明是困难的方式比它应该的。我使用的凯恩戈姆任务库在客户端上生成的图像上执行以下步骤:

I am trying to get an application to upload multiple client side generated images (not files, hence I can't use FileReference), while displaying the progress of the upload. This has proved to be way harder than it should be. I am using Cairngorm Task library to perform the following steps on an image generated on the client:

  1. 生成图纸舞台面积
  2. 内容的BitmapData对象
  3. 恩code中的图像为JPEG异步,以显示进度条(见的 http://dgrigg.com/blog/2009/03/05/as3-jpegen$c$cr-and-big-images/
  4. 异步上传影像(分块,见 http://soenkerohde.com/2010 / 01 /块文件上传/ ),以显示进度
  1. Generate a BitmapData object drawing the contents of an area of the stage
  2. Encode the image as a JPEG asynchronously, as to show a progress bar (see http://dgrigg.com/blog/2009/03/05/as3-jpegencoder-and-big-images/)
  3. Upload the image asynchronously (chunked, see http://soenkerohde.com/2010/01/chunk-file-upload/) to show progress

当用户点击一个按钮,SequenceTask被启动,编码用得好好的,但是当上载任务时,它闯进火海,出现错误:

When the user clicks a button, the SequenceTask gets started, the encoding works like a charm, but when the uploading task occurs, it bursts into flames with the error:

引发SecurityError:错误#2176:某些动作,比如那些显示一个弹出窗口,可能只有在用户交互通过鼠标点击或按键preSS调用,例如:

SecurityError: Error #2176: Certain actions, such as those that display a pop-up window, may only be invoked upon user interaction, for example by a mouse click or button press.

我认为这正在发生,因为你不能启动,而无需用户干预URLLoader.load行动。即使用户的的点击按钮,我想是因为事情开始发生异步此单击事件不再被视为鼻祖。

I believe this is occurring because you cannot initiate a URLLoader.load action without user intervention. Even though the user is clicking on the button, I think because things start happening asynchronously this click event is no longer being considered as the originator.

有没有办法让的URLLoader知道这是鼠标的结果点击?这将是必不可少的分块上传到工作,因为所有的后续块将启动一个新的URLLoader一样,所以我不是100%确定从参考的分块上传者的实际工作。我可能会尝试先运行只是他们的纯code。

Is there a way to let URLLoader know that this is the result of the mouse click? This will be indispensable for the chunked upload to work, because all of the subsequent chunks will initiate a new URLLoader as well, so I'm not 100% sure the chunked uploader from the reference actually works. I might try running just their plain code first.

感谢您的任何想法。

推荐答案

您必须改变,才能上载前强制用户交互的应用程序流量。

You have to change your application flow in order to force a user interaction before the upload.

这行为被介绍有关Flash Player 10(我几乎可以肯定,这并没有与URLLoaders发生在的Flash Player 9)和有没有办法破解它,否则这将是一个重大的安全漏洞。调度假的鼠标事件将无法正常工作,上传/ POST,必须对在用户交互(鼠标点击或键盘快捷键)被捕获时的相同调用堆栈完成的。

This behaviour was introduced on Flash Player 10 (I'm almost sure this didn't happen with URLLoaders on Flash Player 9) and there's no way to circumvent it, otherwise it would be a major security hole. Dispatching "fake" mouse events will not work, the upload/POST has to be done on the same callstack where the user interaction (mouse click or keyboard shortcut) is captured.

检查在Flash Player 10的用户交互要求了解更多信息。

这篇关于凯恩戈姆SequenceTask +的URLLoader抛出由于缺少用户交互引发SecurityError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆