Joh*_*kya 12 security flash events actionscript-3
将Flash与麦克风或摄像头一起使用时,系统会提示用户允许访问这些设备.这是通过内置的安全设置面板完成的.
当用户单击安全设置面板的关闭按钮时,是否有一种方法可以被事件处理程序通知?这似乎不可能......
对于麦克风,当用户更改安全面板中的设置时,可以接收状态事件,但是当用户仍然打开面板时会触发此事件.
Sam*_*aan 13
在尝试搜索解决方案时,我偶然发现了这一点.
Flash Player错误报告WITH WORKAROUND
我还没有测试过这个解决方法,但它应该还能运行吗?祝好运.
编辑:
对于那些不能/不会访问Adobe bug跟踪器的人来说,这是Philippe Piernot最初发布的解决方法:
var closed:Boolean = true;
var dummy:BitmapData;
dummy = new BitmapData(1, 1);
try
{
// Try to capture the stage: triggers a Security error when the settings dialog box is open
dummy.draw(stage);
}
catch (error:Error)
{
closed = false;
}
dummy.dispose();
dummy = null;
Run Code Online (Sandbox Code Playgroud)
cso*_*akk 12
呼叫安全面板(如ns.addStream(mic))
// WHEN PRIVACY PANEL IS ON MOUSE EVENTS ARE DISABLED
stage.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
function onMouseOver(e:Event):void {
trace("privacy panel closed");
//REMOVE THE LISTENER ON FIRST TIME
stage.removeEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
//doStuff
}
Run Code Online (Sandbox Code Playgroud)
小智 6
我已经在下一个方面解决了这个问题:
private function showPrivacyDialog():void {
var spr:Sprite = new Sprite();
stage.focus = spr;
spr.addEventListener( FocusEvent.FOCUS_OUT, handleFocusEvent );
spr.addEventListener( FocusEvent.FOCUS_IN, handleFocusEvent );
Security.showSettings( SecurityPanel.PRIVACY );
}
private function handleFocusEvent( event:Event ):void {
event.target.removeEventListener( event.type, handleFocusEvent );
const closed:Boolean = (event.type == FocusEvent.FOCUS_IN);
trace( "Security Panel just", closed ? "closed!" : "shown!" );
if (closed) {
stage.focus = null; // or it can be restored to the previous value
}
}
Run Code Online (Sandbox Code Playgroud)
检查显示设置对话框的完整util类SecurityPanelUtil,然后将其处理为关闭并立即通过回调通知.