简体   繁体   English

如何在不聚焦Flash电影的情况下检测屏幕阅读器/ MSAA?

[英]How to detect for screenreaders/MSAA without focusing the flash movie?

I am trying to detect for the presence of assistive technology using flash . 我正在尝试使用flash检测辅助技术的存在 When a Flash movie holding the actionscript below on frame 1 is loaded (and screenreader chatting to IE or Firefox over MSAA is active -- JAWS or NVDA), Accessibility.isActive() does not return "true" until the movie is focused. 加载了包含第1帧中下面的动作脚本的Flash电影(并且正在通过MSAA与IE或Firefox聊天的屏幕阅读器处于活动状态-JAWS或NVDA)时,在将电影聚焦之前, Accessibility.isActive()不会返回“ true”。 Well, actually not until some "event" happens. 好吧,实际上直到发生一些“事件”。 The movie will just sit there until I right-click it & show flash player's context menu... it seems only then Accessibility.isActive() returns true. 电影将一直坐在那里,直到我右键单击它并显示Flash Player的上下文菜单...似乎只有Accessibility.isActive()返回true。 Right-clicking is the only way I could get the movie to "wake up". 右键单击是使电影“唤醒”的唯一方法。

How do I get the movie to react on it's own and detect MSAA? 如何让影片自行做出反应并检测MSAA? I've tried sending focus to it with Javascript... can a fake a right-click in javascript or actionscript? 我尝试使用Javascript向其发送焦点...可以伪造一个右键单击javascript或actionscript吗? Or do you know the events a right click is firing in a flash movie -- possibly I can programatically make that event happen? 还是您知道右键单击会在Flash电影中触发的事件-也许我可以通过编程使该事件发生?

My Actionscript: 我的动作:

var x = 0;  
//check if Microsoft Active Accessibility (MSAA) is active.  
//Setting takes 1-2 seconds to detect -- hence the setTimeout loop.  
function check508(){  
    if ( Accessibility.isActive() ) {  
       //remove this later... just visual for testing  
       logo.glogo.logotext.nextFrame();  
       //tell the page's javascript this is a 508 user  
       getURL("javascript:setAccessible();")  
    } else if (x<100) {  
       trace ("There is currently no active accessibility aid. Attempt " + x);  
       x++;  
       setTimeout(check508,200);  
    }  
}  
/*  
//FYI: only checks if browser is MSAA compliant, not that A.T. is actually running. Sigh.  
//This returns true immediately though.  
if (System.capabilities.hasAccessibility) {  
    logo.glogo.logotext.nextFrame();  
    getURL("javascript:setAccessible();")  
};  
*/  
check508();  
stop();  

My HTML: 我的HTML:

<embed id="detector" width="220" height="100" quality="high" wmode="window" type="application/x-shockwave-flash" src="/images/detect.swf" pluginspage="http://www.adobe.com/go/getflashplayer" flashvars="">

Based on this stackoverflow answer , I found a solution: 基于这个stackoverflow答案 ,我找到了一个解决方案:

var fl = document.getElementById("detector"); 
    if (fl) { 
        fl.focus();
    }

It had to be in pure javascript, as written above, attached to your window.load event. 如上所述,它必须使用纯JavaScript附加到window.load事件中。 Trying either jQuery selectors $("#detector").focus() or omitting the if statement and just using document.getElementById("detector").focus() ...both did not work . 尝试使用jQuery选择器$("#detector").focus()或省略if语句,而仅使用document.getElementById("detector").focus() ...两者都不起作用

I then send focus back to the top of the page within my setAccessible() function in the HTML page's Javascript so AT users are not stuck focused to the flash movie on page load. 然后,我将焦点发送回HTML页面Javascript中的setAccessible()函数内的页面顶部,以使AT用户在页面加载时不会停留在Flash电影上。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM