2013-03-18 63 views
1

在JavaScript中的onClick侦听器中,我通过ExternalInterface调用Flash方法来尝试呈现文件保存对话框。然而:是否可以通过ExternalInterface调用来允许FileReference.save()?

Error: 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. 
    at flash.net::FileReference/_save() 
    at flash.net::FileReference/save() 
    at <my code> 
    at Function/http://adobe.com/AS3/2006/builtin::apply() 
    at flash.external::ExternalInterface$/_callIn() 
    at Function/<anonymous>() 

有没有什么办法让这个工作?也许我可以设置一个安全策略,或者让用户批准?我不想在Flash中实现整个按钮。

回答

1

不幸的是,即使响应浏览器中的某些用户交互,也不可能通过ExternalInterface调用FileReference.save()FileReference.browse()。这些函数只允许响应Flash Player中的直接用户交互事件。这些安全性限制已添加到Flash Player 10中。您可以阅读关于它们的更多信息here

因此,您不得不直接在Flash影片中使用按钮。或者,您可以尝试在HTML按钮上放置隐藏的Flash按钮以捕捉鼠标单击。

相关问题