Package | flash.accessibility |
Class | public class AccessibilityImplementation |
Inheritance | AccessibilityImplementation Object |
Subclasses | AccImpl, AccImpl |
Runtime Versions: | Flash Player 9, AIR 2 |
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.
Property | Defined By | ||
---|---|---|---|
constructor : Object
A reference to the class object or constructor function for a given object instance. | Object | ||
errno : uint
Indicates an error code. | AccessibilityImplementation | ||
stub : Boolean
Used to create a component accessibility stub. | AccessibilityImplementation |
Method | Defined By | ||
---|---|---|---|
Static constructor. | AccessibilityImplementation | ||
An IAccessible method that performs the default action associated with the component
that this AccessibilityImplementation represents or of one of its child elements. | AccessibilityImplementation | ||
MSAA method for returning a DisplayObject or Rectangle
specifying the bounding box of a child element in the AccessibilityImplementation. | AccessibilityImplementation | ||
IAccessible method for altering the selection in the component
that this AccessibilityImplementation represents. | AccessibilityImplementation | ||
MSAA method for returning the default action of the component
that this AccessibilityImplementation represents or of one of its child elements. | AccessibilityImplementation | ||
MSAA method for returning the unsigned integer ID of the child element, if any,
that has child focus within the component. | AccessibilityImplementation | ||
MSAA method for returning the name for the component
that this AccessibilityImplementation represents or for one of its child elements. | AccessibilityImplementation | ||
MSAA method for returning the system role for the component
that this AccessibilityImplementation represents or for one of its child elements. | AccessibilityImplementation | ||
MSAA method for returning an array containing the IDs of all child elements that are selected. | AccessibilityImplementation | ||
IAccessible method for returning the current runtime state of the component that this
AccessibilityImplementation represents or of one of its child elements. | AccessibilityImplementation | ||
MSAA method for returning the runtime value of the component that this
AccessibilityImplementation represents or of one of its child elements. | AccessibilityImplementation | ||
AccessibilityImplementation | |||
AccessibilityImplementation | |||
Returns an array containing the unsigned integer IDs of all child elements
in the AccessibilityImplementation. | AccessibilityImplementation | ||
Indicates whether an object has a specified property defined. | Object | ||
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. | AccessibilityImplementation | ||
Indicates whether an instance of the Object class is in the prototype chain of the object specified
as the parameter. | Object | ||
Indicates whether the specified property exists and is enumerable. | Object | ||
Sets the availability of a dynamic property for loop operations. | Object | ||
Returns the string representation of this object, formatted according to locale-specific conventions. | Object | ||
Returns the string representation of the specified object. | Object | ||
Returns the primitive value of the specified object. | Object |
errno | property |
public var errno:uint
Runtime Versions: | Flash Player 9, AIR 2 |
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.
Related API Elements
stub | property |
public var stub:Boolean
Runtime Versions: | Flash Player 9, AIR 2 |
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
.
Related API Elements
The fl.accessibility.AccImpl class in Flash (\Local Settings\Application Data\Adobe\Flash CS5\en_US\Configuration\Classes\mx\accessibility\AccImpl.as)
AccessibilityImplementation | () | Constructor |
public function AccessibilityImplementation()
Runtime Versions: | Flash Player 9, AIR 2 |
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.
Related API Elements
accDoDefaultAction | () | method |
public function accDoDefaultAction(childID:uint):void
Runtime Versions: | Flash Player 9, AIR 2 |
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
.
Parameters
childID:uint — An unsigned integer corresponding to one of the component's child elements,
as defined by getChildIDArray() .
|
Example ( How to use this example )
override public function accDoDefaultAction(childID:uint):void { if (childID > 0) ListBase(master).selectedIndex = childID - 1; }
accLocation | () | method |
public function accLocation(childID:uint):*
Runtime Versions: | Flash Player 9, AIR 2 |
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.
Parameters
childID:uint — An unsigned integer corresponding to one of the component's child elements
as defined by getChildIDArray() .
|
* — DisplayObject or Rectangle specifying the bounding box
of the child element specified by childID parameter.
|
Learn more
Related API Elements
Example ( How to use this example )
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); }
accSelect | () | method |
public function accSelect(operation:uint, childID:uint):void
Runtime Versions: | Flash Player 9, AIR 2 |
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 specifiedchildID
.SELFLAG_EXTENDSELECTION
: Calculate the range of child elements between and including the selection anchor and the specifiedchildID
. IfSELFLAG_ADDSELECTION
is present, add all of these child elements to the selection. IfSELFLAG_REMOVESELECTION
is present, remove all of these child elements from the selection. If neitherSELFLAG_ADDSELECTION
norSELFLAG_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
(withoutSELFLAG_EXTENDSELECTION
): Add the specifiedchildID
to the selection.SELFLAG_REMOVESELECTION
(withoutSELFLAG_EXTENDSELECTION
): Remove the specifiedchildID
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.
Parameters
operation:uint — A bitfield consisting of one or more selection flag constants to indicate
how the item is selected or takes focus.
| |
childID:uint — An unsigned integer corresponding to one of the component's child elements
as defined by getChildIDArray() .
|
Learn more
Related API Elements
Example ( How to use this example )
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; }
get_accDefaultAction | () | method |
public function get_accDefaultAction(childID:uint):String
Runtime Versions: | Flash Player 9, AIR 2 |
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
.
Parameters
childID:uint — An unsigned integer corresponding to one of the component's child elements,
as defined by getChildIDArray() .
|
String — The default action string specified in the MSAA model for the AccessibilityImplementation
or for one of its child elements.
|
Learn more
Related API Elements
Example ( How to use this example )
override public function get_accDefaultAction(childID:uint):String { if (childID == 0) return null; return "Double Click"; }
get_accFocus | () | method |
public function get_accFocus():uint
Runtime Versions: | Flash Player 9, AIR 2 |
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.
Returnsuint — The unsigned integer ID of the child element, if any, that has child focus within the component.
|
Learn more
Related API Elements
Example ( How to use this example )
override public function get_accFocus():uint { var index:uint = ListBase(master).selectedIndex; return index >= 0 ? index + 1 : 0; }
get_accName | () | method |
public function get_accName(childID:uint):String
Runtime Versions: | Flash Player 9, AIR 2 |
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 whenchildID
is zero. IfchildID
is zero but the AccessibilityImplementation has no name,get_accName
should return an empty string to prevent the player from falling back to theAccessibilityProperties.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 whenchildID
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 whenchildID
is zero. IfchildId
is zero but the AccessibilityImplementation has no content,get_accName
should return an empty string to prevent the player from falling back to theAccessibilityProperties.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.
Parameters
childID:uint — An unsigned integer corresponding to one of the component's child elements
as defined by getChildIDArray() .
|
String — Name of the component or one of its child elements.
|
Learn more
Related API Elements
flash.accessibility.AccessibilityProperties
flash.accessibility.AccessibilityProperties.name
mx.accessibility.AccImpl.get_accName()
mx.accessibility.AccImpl.getName()
mx.accessibility.AccImpl.getStatusName()
Example ( How to use this example )
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; }
get_accRole | () | method |
public function get_accRole(childID:uint):uint
Runtime Versions: | Flash Player 9, AIR 2 |
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.
Parameters
childID:uint — An unsigned integer corresponding to one of the component's
child elements as defined by getChildIDArray() .
|
uint — System role associated with the component.
|
Throws
Error — Error code 2143, AccessibilityImplementation.get_accRole() must be overridden from its default.
|
Learn more
Related API Elements
get_accSelection | () | method |
public function get_accSelection():Array
Runtime Versions: | Flash Player 9, AIR 2 |
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.
ReturnsArray — An array of the IDs of all child elements that are selected.
|
Learn more
Related API Elements
Example ( How to use this example )
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; }
get_accState | () | method |
public function get_accState(childID:uint):uint
Runtime Versions: | Flash Player 9, AIR 2 |
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.
Parameters
childID:uint — An unsigned integer corresponding to one of the component's child elements
as defined by getChildIDArray() .
|
uint — A combination of zero, one, or more of the system state constants.
Multiple constants are assembled into a bitfield using | , the bitwise OR operator.
|
Throws
Error — Error code 2144, AccessibilityImplementation.get_accState() must be overridden from its default.
|
Learn more
Related API Elements
Example ( How to use this example )
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; }
get_accValue | () | method |
public function get_accValue(childID:uint):String
Runtime Versions: | Flash Player 9, AIR 2 |
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
.
Parameters
childID:uint — An unsigned integer corresponding to one of the component's child elements
as defined by getChildIDArray() .
|
String — A string representing the runtime value of the component of of one of its child elements.
|
Learn more
Related API Elements
Example ( How to use this example )
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; }
get_selectionActiveIndex | () | method |
get_selectionAnchorIndex | () | method |
getChildIDArray | () | method |
public function getChildIDArray():Array
Runtime Versions: | Flash Player 9, AIR 2 |
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.
ReturnsArray — Array containing the unsigned integer IDs of all child elements in the AccessibilityImplementation.
|
Example ( How to use this example )
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; }
isLabeledBy | () | method |
public function isLabeledBy(labelBounds:Rectangle):Boolean
Runtime Versions: | Flash Player 9, AIR 2 |
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.
Parameters
labelBounds:Rectangle — A Rectangle representing the bounding box of a text object.
|
Boolean — 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.
|
Wed Nov 21 2018, 06:34 AM -08:00