2013-03-18 43 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按鈕以捕捉鼠標單擊。

相關問題