Skip to content

Instantly share code, notes, and snippets.

@itsDanOades
Created July 2, 2014 16:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itsDanOades/103b38e42fcb4cb1bc46 to your computer and use it in GitHub Desktop.
Save itsDanOades/103b38e42fcb4cb1bc46 to your computer and use it in GitHub Desktop.
Using ExternalInterface to send screen reader alerts
ActionScript:
import flash.external.*;
public class MyButton extends Sprite()
{
//Override the visible property to inform the screen reader when this object becomes visible
override public function set visible(value : Boolean) : void
{
super.visible = value;
if(visible)
{
if(ExternalInterface.available)
{
ExternalInterface.call(‘SendScreenReaderAlert’, “My Button is now visible”);
}
}
}
}
JavaScript:
//Create a hidden aria alert
function SendScreenReaderAlert(message) {
$("<div role='alert' style='width: 1px; position: absolute; left: -2500px; overflow: hidden;'><p>" + message + "</p></div>)
.appendTo($('body'));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment