views:

50

answers:

1

I am trying to detect for the presence of assistive technology using 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. 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. 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? I've tried sending focus to it with Javascript... can a fake a right-click in javascript or actionscript? Or do you know the events a right click is firing in a flash movie -- possibly I can programatically make that event happen?

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:

<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="">
A: 

Based on this stackoverflow answer, I found a solution:

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. Trying either jQuery selectors $("#detector").focus() or omitting the if statement and just using document.getElementById("detector").focus() ...both did not work.

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.

utt73