flash.accessibilityISimpleTextSelection The ISimpleTextSelection class can be used to add support for the MSAA ISimpleTextSelection interface to an AccessibilityImplementation. The ISimpleTextSelection class can be used to add support for the MSAA ISimpleTextSelection interface to an AccessibilityImplementation.

If an AccessibilityImplementation subclass implements the two getters in this class, a screen reader such as JAWS can determine the text selection range by calling them. The AccessibilityImplementation subclass does not have to formally declare that it implements this interface; you can simply declare getters for these two properties, as follows:

class TextAreaAccImpl extends AccesibilityImplementation { ... public function get selectionAnchorIndex():int { ... } public function get selectionActiveIndex():int { ... } }
flash.accessibility.AccessibilityImplementationselectionActiveIndex The zero-based character index value of the last character in the current selection.int The zero-based character index value of the last character in the current selection. If you want a component to support inline IME or accessibility, override this method. selectionAnchorIndex The zero-based character index value of the first character in the current selection.int The zero-based character index value of the first character in the current selection. If you want a component to support inline IME or accessibility, override this method.
AccessibilityImplementation The AccessibilityImplementation class is the base class in Flash Player that allows for the implementation of accessibility in components.Object The AccessibilityImplementation class is the base class in Flash Player that allows for the implementation of accessibility in components. This class enables communication between a component and a screen reader. Screen readers are used to translate screen content into synthesized speech or braille for visually impaired users.

The AccessibilityImplementation class provides a set of methods that allow a component developer to make information about system roles, object based events, and states available to assistive technology.

Adobe Flash Player uses Microsoft Active Accessibility (MSAA), which provides a descriptive and standardized way for applications and screen readers to communicate. For more information on how the Flash Player works with MSAA, see the accessibility chapter in Using Flex SDK.

The methods of the AccessibilityImplementation class are a subset of the IAccessible interface for a component instance.

The way that an AccessibilityImplementation implements the IAccessible interface, and the events that it sends, depend on the kind of component being implemented.

Do not directly instantiate AccessibilityImplementation by calling its constructor. Instead, create new accessibility implementations by extending the AccImpl class for each new component. In Flash, see the fl.accessibility package. In Flex, see the mx.accessibility package and the accessibility chapter in Using Flex SDK.

Note: The AccessibilityImplementation class is not supported in AIR runtime versions before AIR 2. The class is available for compilation in AIR versions before AIR 2, but is not supported in the runtime until AIR 2.

AccessibilityImplementation Static constructor. Static constructor. Do not directly instantiate AccessibilityImplementation by calling its constructor. Instead, create new accessibility implementations by extending the mx.accessibility.AccImpl class for each new component. mx.accessibility.AccImplaccDoDefaultAction An IAccessible method that performs the default action associated with the component that this AccessibilityImplementation represents or of one of its child elements.childIDuintAn unsigned integer corresponding to one of the component's child elements, as defined by getChildIDArray(). Performs the default action associated with the component. An IAccessible method that performs the default action associated with the component that this AccessibilityImplementation represents or of one of its child elements.

Implement this method only if the AccessibilityImplementation represents a UI element that has a default action in the MSAA model.

If you are implementing accDoDefaultAction() only for the AccessibilityImplementation itself, or only for its child elements, you will need in some cases to indicate that there is no default action for the particular childID that was passed. Do this by setting the errno property to E_MEMBERNOTFOUND.

Following is an example showing how this method is implemented to perform the appropriate default action in the Flex mx.accessibility.ListBaseAccImpl class, the ListBase Accessibility Implementation. For the ListBase and classes that inherit from it, performing the default action "Double Click" for one of its child list item elements selects that element. override public function accDoDefaultAction(childID:uint):void { if (childID > 0) ListBase(master).selectedIndex = childID - 1; }
accLocation MSAA method for returning a DisplayObject or Rectangle specifying the bounding box of a child element in the AccessibilityImplementation.DisplayObject or Rectangle specifying the bounding box of the child element specified by childID parameter. childIDuintAn unsigned integer corresponding to one of the component's child elements as defined by getChildIDArray(). Returns a DisplayObject or Rectangle object that specifies the bounding box of a child element. MSAA method for returning a DisplayObject or Rectangle specifying the bounding box of a child element in the AccessibilityImplementation.

This method is never called with a childID of zero. If your AccessibilityImplementation will never contain child elements, you should not implement this method. If your AccessibilityImplementation can contain child elements, this method is mandatory.

You can usually satisfy the requirements of this method by returning an object that represents the child element itself. This works as long as the child element is a DisplayObject. In these cases, simply return the DisplayObject that corresponds to the instance name associated with the relevant visual object in display list.

If a child element does not qualify for the technique described above, you may do the bounding-box math yourself and return a Rectangle with: x, y, width, and height properties. The x and y members specify the upper-left corner of the bounding box, and the width and height members specify its size. All four members should be in units of Stage pixels, and relative to the origin of the component that the AccessibilityImplementation represents. The x and y properties may have negative values, since the origin of a DisplayObject is not necessarily in its upper-left corner.

If the child element specified by childID is not visible (that is, get_accState for that child would return a value including STATE_SYSTEM_INVISIBLE), you may return null from accLocation. You can also return a Rectangle representing the coordinates where the child element would appear if it were visible.

The following example shows how this method is implemented to return the location of a given child element in the Flex mx.accessibility.ListBaseAccImpl class, the ListBase accessibility implementation. override public function accLocation(childID:uint):* { var listBase:ListBase = ListBase(master); var index:uint = childID - 1; if (index < listBase.verticalScrollPosition || index >= listBase.verticalScrollPosition + listBase.rowCount) { return null; } var item:Object = getItemAt(index); return listBase.itemToItemRenderer(item); }
flash.display.DisplayObjectflash.geom.RectanglegetChildIDArray()Microsoft Accessibility Developer Center: IAccessible::accLocation
accSelect IAccessible method for altering the selection in the component that this AccessibilityImplementation represents.operationuintA bitfield consisting of one or more selection flag constants to indicate how the item is selected or takes focus. childIDuintAn unsigned integer corresponding to one of the component's child elements as defined by getChildIDArray(). IAccessible method for altering the selection in the component that this AccessibilityImplementation represents.

The childID parameter will always be nonzero. This method always applies to a child element rather than the overall component; Flash Player manages the selection of the overall component itself.

The selFlag parameter is a bitfield consisting of one or more selection flag constants that allows an MSAA client to indicate how the item referenced by the childID should be selected or take focus. What follows are descriptions of the selection flag constants and what they communicate to the accessibility implementation. As a practical matter, most implementations of this method in accessibility implementations that inherit from the Flex mx.accessibility.ListBaseAccImpl class ignore the selFlag constant and instead rely on the component's keyboard selection behavior to handle multi-selection.

The selFlag parameter may or may not contain the SELFLAG_TAKEFOCUS flag. If it does, you should set the child focus to the specified childID, and, unless SELFLAG_EXTENDSELECTION is also present, make that child element the selection anchor. Otherwise, the child focus and selection anchor should remain unmodified, despite the fact that additional flags described below may modify the selection.

The selFlag argument will always contain one of the following four flags, which indicate what kind of selection modification is desired:

  • SELFLAG_TAKESELECTION: Clear any existing selection, and set the selection to the specified childID.

  • SELFLAG_EXTENDSELECTION: Calculate the range of child elements between and including the selection anchor and the specified childID. If SELFLAG_ADDSELECTION is present, add all of these child elements to the selection. If SELFLAG_REMOVESELECTION is present, remove all of these child elements from the selection. If neither SELFLAG_ADDSELECTION nor SELFLAG_REMOVESELECTION is present, all of these child elements should take on the selection anchor's selection state: if the selection anchor is selected, add these child elements to the selection; otherwise remove them from the selection.

  • SELFLAG_ADDSELECTION (without SELFLAG_EXTENDSELECTION): Add the specified childID to the selection.

  • SELFLAG_REMOVESELECTION (without SELFLAG_EXTENDSELECTION): Remove the specified childID from the selection.

Note that for a non-multi-selectable component, the only valid selFlag parameter values are SELFLAG_TAKEFOCUS and SELFLAG_TAKESELECTION. You could in theory also choose to support SELFLAG_REMOVESELECTION for a non-multi-selectable component that allowed the user to force a null selection, but in practice most non-multi-selectable components do not work this way, and MSAA clients may not attempt this type of operation.

If you encounter flags that seem invalid, set errno to E_INVALIDARG.

Finally, note that when accSelect is called, Flash Player ensures that it has host focus (the window focus of its container application), and that your component has focus within Flash Player.

The following example shows how this method is implemented to select a child item in the Flex mx.accessibility.ListBaseAccImpl class, the ListBase accessibility implementation. override public function accSelect(selFlag:uint, childID:uint):void { var listBase:ListBase = ListBase(master); var index:uint = childID - 1; if (index >= 0 && index < listBase.dataProvider.length) listBase.selectedIndex = index; }
getChildIDArray()Microsoft Accessibility Developer Center: IAccessible::accSelect
getChildIDArray Returns an array containing the unsigned integer IDs of all child elements in the AccessibilityImplementation.Array containing the unsigned integer IDs of all child elements in the AccessibilityImplementation. Array Returns an array containing the unsigned integer IDs of all child elements in the AccessibilityImplementation.

The length of the array may be zero. The IDs in the array should appear in the same logical order as the child elements they represent. If your AccessibilityImplementation can contain child elements, this method is mandatory; otherwise, do not implement it.

In assigning child IDs to your child elements, use any scheme that preserves uniqueness within each instance of your AccessibilityImplementation. Child IDs need not be contiguous, and their ordering need not match the logical ordering of the child elements. You should arrange so as to not reuse child IDs; if a child element is deleted, its ID should never be used again for the lifetime of that AccessibilityImplementation instance. Be aware that, due to implementation choices in the Flash player code, undesirable behavior can result if you use child IDs that exceed one million.

The following example shows how this method is implemented to return an array of childIDs in the Flex mx.accessibility.ListBaseAccImpl class, the ListBase Accessibility Implementation. override public function getChildIDArray():Array { var childIDs:Array = []; if (ListBase(master).dataProvider) { var n:uint = ListBase(master).dataProvider.length; for (var i:int = 0; i < n; i++) { childIDs[i] = i + 1; } } return childIDs; }
get_accDefaultAction MSAA method for returning the default action of the component that this AccessibilityImplementation represents or of one of its child elements.The default action string specified in the MSAA model for the AccessibilityImplementation or for one of its child elements. StringchildIDuintAn unsigned integer corresponding to one of the component's child elements, as defined by getChildIDArray(). Returns the default action of the component. MSAA method for returning the default action of the component that this AccessibilityImplementation represents or of one of its child elements.

Implement this method only if the AccessibilityImplementation represents a UI element that has a default action in the MSAA model; be sure to return the exact string that the MSAA model specifies. For example, the default action string for a Button component is "Press."

If you are implementing get_accDefaultAction only for the AccessibilityImplementation itself, or only for its child elements, you will need in some cases to indicate that there is no default action for the particular childID that was passed. Do this by simply returning null.

The following example shows how this method is implemented to return the appropriate default actions in the Flex mx.accessibility.ListBaseAccImpl class, the ListBase accessibility implementation. override public function get_accDefaultAction(childID:uint):String { if (childID == 0) return null; return "Double Click"; }
getChildIDArray()Microsoft Accessibility Developer Center: IAccessible::get_accDefaultAction
get_accFocus MSAA method for returning the unsigned integer ID of the child element, if any, that has child focus within the component.The unsigned integer ID of the child element, if any, that has child focus within the component. uintReturns the unsigned integer ID of the child element that has child focus within the component. MSAA method for returning the unsigned integer ID of the child element, if any, that has child focus within the component. If no child has child focus, the method returns zero. The following example shows how this method is implemented to return the focused childID in the Flex mx.accessibility.ListBaseAccImpl class, the ListBase accessibility implementation. override public function get_accFocus():uint { var index:uint = ListBase(master).selectedIndex; return index >= 0 ? index + 1 : 0; } getChildIDArray()Microsoft Accessibility Developer Center: IAccessible::get_accFocusget_accName MSAA method for returning the name for the component that this AccessibilityImplementation represents or for one of its child elements.Name of the component or one of its child elements. StringchildIDuintAn unsigned integer corresponding to one of the component's child elements as defined by getChildIDArray(). Returns the name of the component MSAA method for returning the name for the component that this AccessibilityImplementation represents or for one of its child elements.

In the case of the AccessibilityImplementation itself (childID == 0), if this method is not implemented, or does not return a value, Flash Player uses the AccessibilityProperties.name property value, if it is present.

For AccessibilityImplementations that can have child elements, this method must be implemented, and must return a string value when childID is nonzero.

Depending on the type of user interface element, names in MSAA mean one of two different things: an author-assigned name, or the actual text content of the element. Usually, an AccessibilityImplementation itself will fall into the former category. Its name property is an author-assigned name. Child elements always fall into the second category. Their names indicate their text content.

When the name property of an AccessibilityImplementation has the meaning of an author-assigned name, there are two ways in which components can acquire names from authors. The first entails names present within the component itself; for example, a checkbox component might include a text label that serves as its name. The second—a fallback from the first—entails names specified in the UI and ending up in AccessibilityProperties.name. This fallback option allows users to specify names just as they would for any other Sprite or MovieClip.

This leaves three possibilities for the AccessibilityImplementation itself (childID == zero):

  • Author-assigned name within component. The get_accName method should be implemented and should return a string value that contains the AccessibilityImplementation's name when childID is zero. If childID is zero but the AccessibilityImplementation has no name, get_accName should return an empty string to prevent the player from falling back to the AccessibilityProperties.name property.

  • Author-assigned name from UI. If the AccessibilityImplementation can have child elements, the get_accName method should be implemented but should not return a value when childID is zero. If the AccessibilityImplementation will never have child elements, get_accName should not be implemented.

  • Name signifying content. The get_accName method should be implemented and should return an appropriate string value when childID is zero. If childId is zero but the AccessibilityImplementation has no content, get_accName should return an empty string to prevent the player from falling back to the AccessibilityProperties.name property.

Note that for child elements (if the AccessibilityImplementation can have them), the third case always applies. The get_accName method should be implemented and should return an appropriate string value when childID is nonzero.

The following example shows how this method is implemented in the Flex mx.accessibility.AccImpl class, the base accessibility implementation in Flex. override public function get_accName(childID:uint):String { // Start with the name of the component's parent form // if the component is contained within a form var accName:String = UIComponentAccImpl.getFormName(master); // If the element requested is the component itself, // append the value of any assigned accessibilityProperties.name if (childID == 0 && master.accessibilityProperties && master.accessibilityProperties.name && master.accessibilityProperties.name != "") accName += master.accessibilityProperties.name + " "; // Append the value of the childIDs name // returned by the component-specific override // of the mx.accessibility.AccImpl.getName() utility function, // and append the component's status returned by the // component-specific override of the // mx.accessibility.AccImpl.getStatusName() utility function accName += getName(childID) + getStatusName(); // Return the assembled String if it is neither empty nor null, // otherwise return null return (accName != null && accName != "") ? accName : null; }
getChildIDArray()flash.accessibility.AccessibilityPropertiesflash.accessibility.AccessibilityProperties.namemx.accessibility.AccImpl.get_accName()mx.accessibility.AccImpl.getName()mx.accessibility.AccImpl.getStatusName()Microsoft Accessibility Developer Center: IAccessible::get_accName
get_accRole MSAA method for returning the system role for the component that this AccessibilityImplementation represents or for one of its child elements.Error code 2143, AccessibilityImplementation.get_accRole() must be overridden from its default. ErrorErrorSystem role associated with the component. uintchildIDuintAn unsigned integer corresponding to one of the component's child elements as defined by getChildIDArray(). Returns the system role for the component MSAA method for returning the system role for the component that this AccessibilityImplementation represents or for one of its child elements. System roles are predefined for all the components in MSAA. getChildIDArray()AccessibilityImplementation Constants: Object Role ConstantsMicrosoft Accessibility Developer Center: IAccessible::get_accRoleget_accSelection MSAA method for returning an array containing the IDs of all child elements that are selected.An array of the IDs of all child elements that are selected. ArrayReturns an array containing the IDs of all selected child elements. MSAA method for returning an array containing the IDs of all child elements that are selected. The returned array may contain zero, one, or more IDs, all unsigned integers. The following example shows how this method is implemented to return the selected childIDs in the Flex mx.accessibility.ListBaseAccImpl class, the ListBase accessibility implementation. override public function get_accSelection():Array { var accSelection:Array = []; var selectedIndices:Array = ListBase(master).selectedIndices; var n:int = selectedIndices.length; for (var i:int = 0; i < n; i++) { accSelection[i] = selectedIndices[i] + 1; } return accSelection; } getChildIDArray()Microsoft Accessibility Developer Center: IAccessible::get_accSelectionget_accState IAccessible method for returning the current runtime state of the component that this AccessibilityImplementation represents or of one of its child elements.Error code 2144, AccessibilityImplementation.get_accState() must be overridden from its default. ErrorErrorA combination of zero, one, or more of the system state constants. Multiple constants are assembled into a bitfield using |, the bitwise OR operator. uintchildIDuintAn unsigned integer corresponding to one of the component's child elements as defined by getChildIDArray(). Returns the state of the component IAccessible method for returning the current runtime state of the component that this AccessibilityImplementation represents or of one of its child elements.

This method must return a combination of zero, one, or more of the predefined object state constants for components in MSAA. When more than one state applies, the state constants should be combined into a bitfield using |, the bitwise OR operator.

To indicate that none of the state constants currently applies, this method should return zero.

You should not need to track or report the STATE_SYSTEM_FOCUSABLE or STATE_SYSTEM_FOCUSED states. Flash Player handles these states automatically.

The following example shows how this method is implemented to combine more than one state constant in mx.accessibility.ListBaseAccImpl, the Flex ListBase Accessibility Implementation. override public function get_accState(childID:uint):uint { var accState:uint = getState(childID); if (childID > 0) { var listBase:ListBase = ListBase(master); var index:uint = childID - 1; // For returning states (OffScreen and Invisible) // when the list Item is not in the displayed rows. if (index < listBase.verticalScrollPosition || index >= listBase.verticalScrollPosition + listBase.rowCount) { accState |= (STATE_SYSTEM_OFFSCREEN | STATE_SYSTEM_INVISIBLE); } else { accState |= STATE_SYSTEM_SELECTABLE; var item:Object = getItemAt(index); var renderer:IListItemRenderer = listBase.itemToItemRenderer(item); if (renderer != null && listBase.isItemSelected(renderer.data)) accState |= STATE_SYSTEM_SELECTED | STATE_SYSTEM_FOCUSED; } } return accState; }
getChildIDArray()AccessibilityImplementation Constants: Object State ConstantsMicrosoft Accessibility Developer Center: IAccessible::get_accState
get_accValue MSAA method for returning the runtime value of the component that this AccessibilityImplementation represents or of one of its child elements.A string representing the runtime value of the component of of one of its child elements. StringchildIDuintAn unsigned integer corresponding to one of the component's child elements as defined by getChildIDArray(). Returns the value of the component MSAA method for returning the runtime value of the component that this AccessibilityImplementation represents or of one of its child elements.

Implement this method only if your AccessibilityImplementation represents a UI element that has a value in the MSAA model. Be aware that some UI elements that have an apparent 'value' actually expose this value by different means, such as get_accName (text, for example), get_accState (check boxes, for example), or get_accSelection (list boxes, for example).

If you are implementing get_accValue only for the AccessibilityImplementation itself, or only for its child elements, you will need in some cases to indicate that there is no concept of value for the particular childID that was passed. Do this by simply returning null.

The following example shows how this method is implemented to return the appropriate value based on the component's selectedIndex value in the Flex mx.accessibility.ListBaseAccImpl class, the ListBase accessibility implementation. override public function get_accValue(childID:uint):String { var accValue:String; var listBase:ListBase = ListBase(master); var index:int = listBase.selectedIndex; if (childID == 0) { if (index > -1) { var item:Object = getItemAt(index); if (item is String) { accValue = item + " " + (index + 1) + " of " + listBase.dataProvider.length; } else { accValue = listBase.itemToLabel(item) + " " + (index + 1) + " of " + listBase.dataProvider.length; } } } return accValue; }
getChildIDArray()Microsoft Accessibility Developer Center: IAccessible::get_accValue
isLabeledBy Returns true or false to indicate whether a text object having a bounding box specified by a x, y, width, and height should be considered a label for the component that this AccessibilityImplementation represents.true or false to indicate whether a text object having the given label bounds should be considered a label for the component that this AccessibilityImplementation represents. BooleanlabelBoundsflash.geom:RectangleA Rectangle representing the bounding box of a text object. Indicates whether a nearby text object is a label for this component. Returns true or false to indicate whether a text object having a bounding box specified by a x, y, width, and height should be considered a label for the component that this AccessibilityImplementation represents.

The x and y coordinates are relative to the upper-left corner of the component to which the AccessibilityImplementation applies, and may be negative. All coordinates are in units of Stage pixels.

This method allows accessible components to fit into the Flash Player's search for automatic labeling relationships, which allow text external to an object to supply the object's name. This method is provided because it is expected that the criteria for recognizing labels will differ from component to component. If you implement this method, you should aim to use geometric criteria similar to those in use inside the player code for buttons and textfields. Those criteria are as follows:

  • For buttons, any text falling entirely inside the button is considered a label.
  • For textfields, any text appearing nearby above and left-aligned, or nearby to the left, is considered a label.

If the component that the AccessibilityImplementation represents should never participate in automatic labeling relationships, do not implement isLabeledBy. This is equivalent to always returning false. One case in which isLabeledBy should not be implemented is when the AccessibilityImplementation falls into the "author-assigned name within component" case described under get_accName above.

Note that this method is not based on any IAccessible method; it is specific to Flash.

errno Indicates an error code.uint Indicates an error code. Errors are indicated out-of-band, rather than in return values. To indicate an error, set the errno property to one of the error codes documented in the AccessibilityImplementation Constants appendix. This causes your return value to be ignored. The errno property of your AccessibilityImplementation is always cleared (set to zero) by the player before any AccessibilityImplementation method is called. AccessibilityImplementation Constantsstub Used to create a component accessibility stub.Boolean Used to create a component accessibility stub. If a component is released without an ActionScript accessibility implementation, Adobe recommends that you add a component accessibility stub. This stub causes Flash Player, for accessibility purposes, to treat the component as a simple graphic rather than exposing the internal structure of buttons, textfields, and so on, within the component.

To create a component accessibility stub, subclass the relevant AccImpl class, overriding the property stub with a value of true.

The mx.accessibility.AccImpl class in Flex (\sdks\4.0.0\frameworks\projects\framework\src\mx\accessibility\AccImpl.as)The fl.accessibility.AccImpl class in Flash (\Local Settings\Application Data\Adobe\Flash CS5\en_US\Configuration\Classes\mx\accessibility\AccImpl.as)
AccessibilityProperties The AccessibilityProperties class lets you control the presentation of Flash objects to accessibility aids, such as screen readers.Object The AccessibilityProperties class lets you control the presentation of Flash objects to accessibility aids, such as screen readers.

You can attach an AccessibilityProperties object to any display object, but Flash Player will read your AccessibilityProperties object only for certain kinds of objects: entire SWF files (as represented by DisplayObject.root), container objects (DisplayObjectContainer and subclasses), buttons (SimpleButton and subclasses), and text (TextField and subclasses).

The name property of these objects is the most important property to specify because accessibility aids provide the names of objects to users as a basic means of navigation. Do not confuse AccessibilityProperties.name with DisplayObject.name; these are separate and unrelated. The AccessibilityProperties.name property is a name that is read aloud by the accessibility aids, whereas DisplayObject.name is essentially a variable name visible only to ActionScript code.

In Flash Professional, the properties of AccessibilityProperties objects override the corresponding settings available in the Accessibility panel during authoring.

To determine whether Flash Player is running in an environment that supports accessibility aids, use the Capabilities.hasAccessibility property. If you modify AccessibilityProperties objects, you need to call the Accessibility.updateProperties() method for the changes to take effect.

The following example uses the AccessibilityExample, CustomAccessibleButton, CustomSimpleButton, and ButtonDisplayState classes to create an accessibility-compliant menu that works with common screen readers. The main functionality of the AccessibilityProperties class is as follows:
  1. Call configureAssets, which creates a custom button and sets its label and description. These are the values that the screen reader conveys to the end user.
  2. Call setTimeOut() to ensure that Flash Player has enough time to detect the screen reader before updating the properties.

Note: Call setTimeout() before checking Accessibility.active. to give Flash Player the 2 seconds it needs to connect to a screen reader, if one is available. If you do not provide a sufficient delay time, the setTimeout call might return false, even if a screen reader is available.

The following example processes the Accessibility.updateProperties() method only if the call to Accessibility.active returns true, which occurs only if Flash Player is currently connected to an active screen reader. If updateProperties is called without an active screen reader, it throws an IllegalOperationError exception.

package { import flash.display.Sprite; import flash.accessibility.Accessibility; import flash.utils.setTimeout; public class AccessibilityPropertiesExample extends Sprite { public static const BUTTON_WIDTH:uint = 90; public static const BUTTON_HEIGHT:uint = 20; private var gutter:uint = 5; private var menuLabels:Array = new Array("PROJECTS", "PORTFOLIO", "CONTACT"); private var menuDescriptions:Array = new Array("Learn more about our projects" , "See our portfolio" , "Get in touch with our team"); public function AccessibilityPropertiesExample() { configureAssets(); setTimeout(updateAccessibility, 2000); } private function updateAccessibility():void { trace("Accessibility.active: " + Accessibility.active); if(Accessibility.active) { Accessibility.updateProperties(); } } private function configureAssets():void { var child:CustomAccessibleButton; for(var i:uint; i < menuLabels.length; i++) { child = new CustomAccessibleButton(); child.y = (numChildren * (BUTTON_HEIGHT + gutter)); child.setLabel(menuLabels[i]); child.setDescription(menuDescriptions[i]); addChild(child); } } } import flash.accessibility.AccessibilityProperties; import flash.display.Shape; import flash.display.SimpleButton; import flash.display.Sprite; import flash.events.Event; import flash.text.TextFormat; import flash.text.TextField; class CustomAccessibleButton extends Sprite { private var button:SimpleButton; private var label1:TextField; private var description:String; private var _name:String; public function CustomAccessibleButton(_width:uint = 0, _height:uint = 0) { _width = (_width == 0) ? AccessibilityPropertiesExample.BUTTON_WIDTH : _width; _height = (_height == 0) ? AccessibilityPropertiesExample.BUTTON_HEIGHT : _height; button = buildButton(_width, _height); label1 = buildLabel(_width, _height); addEventListener(Event.ADDED, addedHandler); } private function addedHandler(event:Event):void { trace("addedHandler: " + name); var accessProps:AccessibilityProperties = new AccessibilityProperties(); accessProps.name = this._name; accessProps.description = description; accessibilityProperties = accessProps; removeEventListener(Event.ADDED, addedHandler); } private function buildButton(_width:uint, _height:uint):SimpleButton { var child:SimpleButton = new CustomSimpleButton(_width, _height); addChild(child); return child; } private function buildLabel(_width:uint, _height:uint):TextField { var format:TextFormat = new TextFormat(); format.font = "Verdana"; format.size = 11; format.color = 0xFFFFFF; format.align = TextFormatAlign.CENTER; format.bold = true; var child:TextField = new TextField(); child.y = 1; child.width = _width; child.height = _height; child.selectable = false; child.defaultTextFormat = format; child.mouseEnabled = false; addChild(child); return child; } public function setLabel(text:String):void { label1.text = text; this._name = text; } public function setDescription(text:String):void { description = text; } } class CustomSimpleButton extends SimpleButton { private var upColor:uint = 0xFFCC00; private var overColor:uint = 0xCCFF00; private var downColor:uint = 0x00CCFF; public function CustomSimpleButton(_width:uint, _height:uint) { downState = new ButtonDisplayState(downColor, _width, _height); overState = new ButtonDisplayState(overColor, _width, _height); upState = new ButtonDisplayState(upColor, _width, _height); hitTestState = new ButtonDisplayState(upColor, _width, _height); useHandCursor = true; } } class ButtonDisplayState extends Shape { private var bgColor:uint; private var _width:uint; private var _height:uint; public function ButtonDisplayState(bgColor:uint, _width:uint, _height:uint) { this.bgColor = bgColor; this._width = _width; this._height = _height; draw(); } private function draw():void { graphics.beginFill(bgColor); graphics.drawRect(0, 0, _width, _height); graphics.endFill(); } } }
flash.accessibility.Accessibility.updateProperties()flash.display.DisplayObject.accessibilityPropertiesflash.display.InteractiveObject.tabIndexflash.system.Capabilities.hasAccessibilityAccessibilityProperties Creates a new AccessibilityProperties object. Creates a new AccessibilityProperties object. description Provides a description for this display object in the accessible presentation.String Provides a description for this display object in the accessible presentation. If you have a lot of information to present about the object, it is best to choose a concise name and put most of your content in the description property. Applies to whole SWF files, containers, buttons, and text. The default value is an empty string.

In Flash Professional, this property corresponds to the Description field in the Accessibility panel.

forceSimple If true, causes Flash Player to exclude child objects within this display object from the accessible presentation.Boolean If true, causes Flash Player to exclude child objects within this display object from the accessible presentation. The default is false. Applies to whole SWF files and containers. name Provides a name for this display object in the accessible presentation.String Provides a name for this display object in the accessible presentation. Applies to whole SWF files, containers, buttons, and text. Do not confuse with DisplayObject.name, which is unrelated. The default value is an empty string.

In Flash Professional, this property corresponds to the Name field in the Accessibility panel.

noAutoLabeling If true, disables the Flash Player default auto-labeling system.Boolean If true, disables the Flash Player default auto-labeling system. Auto-labeling causes text objects inside buttons to be treated as button names, and text objects near text fields to be treated as text field names. The default is false. Applies only to whole SWF files.

The noAutoLabeling property value is ignored unless you specify it before the first time an accessibility aid examines your SWF file. If you plan to set noAutoLabeling to true, you should do so as early as possible in your code.

shortcut Indicates a keyboard shortcut associated with this display object.String Indicates a keyboard shortcut associated with this display object. Supply this string only for UI controls that you have associated with a shortcut key. Applies to containers, buttons, and text. The default value is an empty string.

Note: Assigning this property does not automatically assign the specified key combination to this object; you must do that yourself, for example, by listening for a KeyboardEvent.

The syntax for this string uses long names for modifier keys, and the plus(+) character to indicate key combination. Examples of valid strings are "Ctrl+F", "Ctrl+Shift+Z", and so on.

silent If true, excludes this display object from accessible presentation.Boolean If true, excludes this display object from accessible presentation. The default is false. Applies to whole SWF files, containers, buttons, and text.
ISearchableText The ISearchableText interface can be implemented by objects that contain text which should be searchable on the web. The ISearchableText interface can be implemented by objects that contain text which should be searchable on the web. searchText Gets the search text from a component implementing ISearchableText.String Gets the search text from a component implementing ISearchableText. Accessibility The Accessibility class manages communication with screen readers.Object The Accessibility class manages communication with screen readers. Screen readers are a type of assistive technology for visually impaired users that provides an audio version of screen content. The methods of the Accessibility class are static—that is, you don't have to create an instance of the class to use its methods.

Mobile Browser Support: This class is not supported in mobile browsers.

AIR profile support: This feature is supported on all desktop operating systems, but is not supported on mobile devices or on AIR for TV devices. See AIR Profile Support for more information regarding API support across multiple profiles.

To get and set accessible properties for a specific object, such as a button, movie clip, or text field, use the DisplayObject.accessibilityProperties property. To determine whether the player or runtime is running in an environment that supports accessibility aids, use the Capabilities.hasAccessibility property.

Note: AIR 2 supports the JAWS 11 (or higher) screen reader software. For additional information, please see http://www.adobe.com/accessibility/.

The following example uses AccessibilityExample, CustomAccessibleButton, CustomSimpleButton, and ButtonDisplayState sample classes to create an accessibility-compliant menu that works with most screen readers. The example carries out the following tasks:
  1. It traces the Accessibility.active property to determine whether a screen reader is currently active and the player is communicating with it.
  2. If the active property returns true, the example calls the updateProperties() method to apply the accessibility changes made to the buttons in this example.
  3. The example calls the flash.utils.setTimeout() method, specifying that the updateAccessibility() closure method should be called after 2 seconds.

Note: Call setTimeout() before checking Accessibility.active to give Flash Player the 2 seconds it needs to connect to a screen reader if one is available. If you do not supply a sufficient delay time, the setTimeout call might return false even if a screen reader is available.

The following example processes the Accessibility.updateProperties() method only if the call to Accessibility.active returns true, which occurs only if Flash Player is currently connected to an active screen reader. If updateProperties is called without an active screen reader, it throws an IllegalOperationError exception.

package { import flash.display.Sprite; import flash.accessibility.Accessibility; import flash.utils.setTimeout; public class AccessibilityExample extends Sprite { public static const BUTTON_WIDTH:uint = 90; public static const BUTTON_HEIGHT:uint = 20; private var gutter:uint = 5; private var menuLabels:Array = new Array("PROJECTS", "PORTFOLIO", "CONTACT"); private var menuDescriptions:Array = new Array("Learn more about our projects" , "See our portfolio" , "Get in touch with our team"); public function AccessibilityExample() { configureAssets(); setTimeout(updateAccessibility, 2000); } private function updateAccessibility():void { trace("Accessibility.active: " + Accessibility.active); if(Accessibility.active) { Accessibility.updateProperties(); } } private function configureAssets():void { var child:CustomAccessibleButton; for(var i:uint; i < menuLabels.length; i++) { child = new CustomAccessibleButton(); child.y = (numChildren * (BUTTON_HEIGHT + gutter)); child.setLabel(menuLabels[i]); child.setDescription(menuDescriptions[i]); addChild(child); } } } } import flash.accessibility.AccessibilityProperties; import flash.display.Shape; import flash.display.SimpleButton; import flash.display.Sprite; import flash.events.Event; import flash.text.TextFormat; import flash.text.TextField; class CustomAccessibleButton extends Sprite { private var button:SimpleButton; private var label:TextField; private var description:String; private var _name:String; public function CustomAccessibleButton(_width:uint = 0, _height:uint = 0) { _width = (_width == 0) ? AccessibilityExample.BUTTON_WIDTH : _width; _height = (_height == 0) ? AccessibilityExample.BUTTON_HEIGHT : _height; button = buildButton(_width, _height); label = buildLabel(_width, _height); addEventListener(Event.ADDED, addedHandler); } private function addedHandler(event:Event):void { trace("addedHandler: " + this._name); var accessProps:AccessibilityProperties = new AccessibilityProperties(); accessProps.name = this._name; accessProps.description = description; accessibilityProperties = accessProps; removeEventListener(Event.ADDED, addedHandler); } private function buildButton(_width:uint, _height:uint):SimpleButton { var child:SimpleButton = new CustomSimpleButton(_width, _height); addChild(child); return child; } private function buildLabel(_width:uint, _height:uint):TextField { var format:TextFormat = new TextFormat(); format.font = "Verdana"; format.size = 11; format.color = 0xFFFFFF; format.align = TextFormatAlign.CENTER; format.bold = true; var child:TextField = new TextField(); child.y = 1; child.width = _width; child.height = _height; child.selectable = false; child.defaultTextFormat = format; child.mouseEnabled = false; addChild(child); return child; } public function setLabel(text:String):void { label.text = text; this._name = text; } public function setDescription(text:String):void { description = text; } } class CustomSimpleButton extends SimpleButton { private var upColor:uint = 0xFFCC00; private var overColor:uint = 0xCCFF00; private var downColor:uint = 0x00CCFF; public function CustomSimpleButton(_width:uint, _height:uint) { downState = new ButtonDisplayState(downColor, _width, _height); overState = new ButtonDisplayState(overColor, _width, _height); upState = new ButtonDisplayState(upColor, _width, _height); hitTestState = new ButtonDisplayState(upColor, _width, _height); useHandCursor = true; } } class ButtonDisplayState extends Shape { private var bgColor:uint; private var _width:uint; private var _height:uint; public function ButtonDisplayState(bgColor:uint, _width:uint, _height:uint) { this.bgColor = bgColor; this._width = _width; this._height = _height; draw(); } private function draw():void { graphics.beginFill(bgColor); graphics.drawRect(0, 0, _width, _height); graphics.endFill(); } }
flash.display.DisplayObject.accessibilityPropertiesflash.system.Capabilities.hasAccessibilitySockethttp://www.adobe.com/accessibility/updateProperties Tells Flash Player to apply any accessibility changes made by using the DisplayObject.accessibilityProperties property.Accessibility is not supported in this version of Flash Player. Do not call the Accessibility.updateProperties() method if the flash.system.Capabilities.hasAccessibility property is false. IllegalOperationErrorflash.errors:IllegalOperationError Tells Flash Player to apply any accessibility changes made by using the DisplayObject.accessibilityProperties property. You need to call this method for your changes to take effect.

If you modify the accessibility properties for multiple objects, only one call to the Accessibility.updateProperties() method is necessary; multiple calls can result in reduced performance and erroneous screen reader output.

activeflash.display.DisplayObject.accessibilityPropertiesflash.system.Capabilities.hasAccessibility
active Indicates whether a screen reader is active and the application is communicating with it.Boolean Indicates whether a screen reader is active and the application is communicating with it. Use this method when you want your application to behave differently in the presence of a screen reader.

Once this property is set to true, it remains true for the duration of the application. (It is unusual for a user to turn off the screen reader once it is started.)

Note: Before calling this method, wait 1 or 2 seconds after launching your AIR application or after the first appearance of the Flash® Player window in which your document is playing. Otherwise, you might get a return value of false even if there is an active accessibility client. This happens because of an asynchronous communication mechanism between accessibility clients and Flash Player or AIR.

To determine whether the player is running in an environment that supports screen readers, use the Capabilities.hasAccessibility property.
flash.system.Capabilities.hasAccessibilityupdateProperties()