The objective of this technique is to provide an accessible name to
the built in form components provided by Flash. Some components, such
as radio buttons, checkboxes and buttons, have their own label property.
For other components, the developer needs to specify the component's
label text as accessible name. This can be either be achieved through
the Accessibility panel (for components placed on the stage during
authoring) or through scripting (for components that are dynamically
created at runtime).
ActionScript 2
In ActionScript 2 the accessible name needs to be set on a component's
_accProps property. This property must be an object. If the property
has not been set yet, the developer needs to create a custom object
and assign it to the _accProps property. The object itself can have
several accessibility related properties, one of them being _accProps.name,
which specifies the accessible name. When an _accProps property is
updated, the developer must call Accessibility.UpdateProperties() for
the changes to take effect. Before calling Accessibility.UpdateProperties(),
it is recommended to check the System.capabilities.hasAccessibility
flag. this will prevent an error on environments that do not support
MSAA.
ActionScript 2 provides the following accessible components:
ActionScript 3
In ActionScript 3 the accessible name needs to be set on a component's
accessibilityProperties property. This property must be an instance
of flash.accessibility.AccessibilityProperties. If the property has
not been set yet, the developer needs to create the a new AccessibilityProperties
instance and assign it to the accessibilityProperties property. The
object itself can have several accessibility related properties, one
of them being accessibilityProperties.name which specifies the accessible
name. When an accessibilityProperties property is updated, the developer
must call flash.accessibility.Accessibility.UpdateProperties() for the
changes to take effect. Before calling Accessibility.UpdateProperties(),
it is recommended to check the flash.system.capabilities.hasAccessibility
flag. this will prevent an error on environments that do not support
MSAA.
ActionScript 3 provides the following accessible components.
To add and label a component control, follow these steps:
The code example below shows how a ListBox component is created and assigned an accessible name.
mx.accessibility.ListAccImpl.enableAccessibility();
this.createClassObject(mx.controls.List, "my_list", 1);
my_list.addItem({label: "R. Davis", data: 1});
my_list.addItem({label: "V. Mann", data: 2});
my_list.addItem({label: "L. Heart", data: 3});
my_list.addItem({label: "P. Hill", data: dt4});
my_list.addItem({label: "D. Gribble", data: 5});
my_list.move(10, 10);
if (System.capabilities.hasAccessibility) {
my_list._accProps = new Object();
my_list._accProps.name = "Staff Members";
Accessibility.updateProperties();
}
This result can be viewed in the working version of Setting the accessible name through ActionScript 2.0. The source of Setting the accessible name through ActionScript 2.0 is available.
The code example below shows how a ListBox component is created and assigned an accessible name.
import fl.controls.List;
import fl.accessibility.ListAccImpl;
import flash.system.Capabilities;
import flash.accessibility.*;
ListAccImpl.enableAccessibility();
var my_list:List = new List();
my_list.addItem({label:"R. Davis", data:1});
my_list.addItem({label:"V. Mann", data:2});
my_list.addItem({label:"L. Heart", data:3});
my_list.addItem({label:"P. Hill", data:4});
my_list.addItem({label:"D. Gribble", data:5});
my_list.x = my_list.y = 10;
if (Capabilities.hasAccessibility) {
var accProps:AccessibilityProperties = new AccessibilityProperties();
accProps.name = "Staff Members";
my_list.accessibilityProperties = accProps;
Accessibility.updateProperties();
}
addChild(my_list);
This result can be viewed in the working version of Setting the accessible name through ActionScript 3.0. The source of Setting the accessible name through ActionScript 3.0 is available.
For Flash movies that contain form components, confirm that either:
_accProps.name property accessibilityProperties.name property One of the above is true