apache-flex - 如何解决 Flash 错误 2176

标签 apache-flex flash

在我的 Flex 应用程序中,用户需要能够上传和下载内容。但是,此内容受到访问限制,我需要在允许上传/下载之前进行权限检查。用户单击链接,然后使用 FileReference 类选择文件。 FileReference 类不附加 cookie 信息,因此我无法使用 session 。

我想实现一个两步过程,其中客户端首先 ping 服务器以获取一次性 token ,然后使用一次性 token 作为参数进行上传或下载。然而,这个计划被错误 #2176 挫败,这显然是 FP10 的安全修复,只允许在 MouseEvent 传播期间触发上传/下载。不管怎样?

最佳答案

我找到了解决方法 here.

 <?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" 
                layout="absolute" 
                minWidth="955" minHeight="600"
                creationComplete="creationCompleteHandler(event)">
    <mx:Script>
        <![CDATA[
            import mx.controls.Alert;
            import mx.events.CloseEvent;
            import mx.events.FlexEvent;

            protected function creationCompleteHandler(event:FlexEvent):void
            {
                Alert.show("Now you can save the file!", "Test", Alert.OK|Alert.CANCEL, null, closeHandler);
            }

            protected function closeHandler( event:CloseEvent ):void
            {
                var fileReference :FileReference;

                if ( event.detail == Alert.OK )
                {
                    fileReference = new FileReference();
                    fileReference.save("http://www.bogdanmanate.com", "test.txt");
                }
            }
        ]]>
    </mx:Script>

</mx:Application>

关于apache-flex - 如何解决 Flash 错误 2176,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2859336/

相关文章:

apache-flex - Flex 中的某些 [Bindable] 属性有效,有些则无效

javascript - 缩放 html 以根据屏幕分辨率按比例调整大小

android - Galaxy S4 和 libmedia.so 杀死 Flash

flash - 有人遇到这个错误吗? RTMP 流媒体视频提前 3-4 秒结束?

flash as3 - 创建坐标点数组

python - 从非列文件中提取数据(在 awk 中)

apache-flex - 将 CSS 文件中的 ClassReference 编译到 Swf 文件时找不到定义错误

flash - 无法运行 Flash Builder 4.6 调试器

actionscript-3 - flash as3 - 我需要在 byteArray 数据中进行二进制搜索

apache-flex - 日期到字符串 <-> 字符串到日期