Creating accessible documents with ActionScript

In addition to the accessibility features included in the Flash user interface, you can create accessible documents with ActionScript. For accessibility properties that apply to the entire document, you can create or modify a global variable called _accProps. See _accProps.

For properties that apply to a specific object, you can use the syntax instancename._accProps. The value of _accProps is an object that can include any of the following properties:

Property

Type

Equivalent selection in the Accessibility panel

Applies to

.silent

Boolean

Make Movie Accessible/Make Object Accessible (inverse logic)

Entire documents

Buttons

Movie clips

Dynamic text

Input text

.forceSimple

Boolean

Make Child Objects Accessible (inverse logic)

Entire documents

Movie clips

.name

string

Name

Entire documents

Buttons

Movie clips

Input text

.description

string

Description

Entire documents

Buttons

Movie clips

Dynamic text

Input text

.shortcut

string

Shortcut

Buttons

Movie clips

Input text

Note: Inverse logic means that a value of true in ActionScript corresponds to a checkbox that is not selected in the Accessibility panel, and a value of false in ActionScript corresponds to a selected checkbox in the Accessibility panel.

Modifying the _accProps variable has no effect by itself. You must also use the Accessibility.updateProperties method to inform screen reader users of Flash content changes. Calling the method causes Flash Player to re-examine all accessibility properties, update property descriptions for the screen reader, and, if necessary, send events to the screen reader that indicate changes have occurred.

When updating accessibility properties of multiple objects at once, you only need to include a single call to Accessiblity.updateProperties (too frequent updates to the screen reader can cause some screen readers to become too verbose).

See Accessibility.updateProperties().

Implementing screen reader detection with the Accessibility.isActive() method

To create Flash content that behaves in a specific way if a screen reader is active, you can use the ActionScript method Accessibility.isActive, which returns a value of true if a screen reader is present, and false otherwise. You can then design your Flash content to perform in a way that's compatible with screen reader use, such as by hiding child elements from the screen reader. For detailed information, See Accessibility.isActive().

For example, you could use the Accessibility.isActive method to decide whether to include unsolicited animation or not. Unsolicited animation means animation that happens without the screen reader doing anything. This can be very confusing for screen readers.

The Accessibility.isActive() method provides asynchronous communication between the Flash content and Flash Player, which means that a slight real-time delay could occur between the time the method is called and the time in which Flash Player becomes active, returning an incorrect value of False. To ensure that the method is called correctly, you can do one of the following:

Using ActionScript to create a tab order for accessible objects

In addition to assigning a tab index to objects with the Accessibility panel (see Creating a tab order index for keyboard navigation in the Accessibility panel (Flash Professional only)), you can create the tab order with ActionScript by assigning the tabIndex property to the following objects:

If you create a tab order for a frame and you don't specify a tab order for an accessible object in the frame, Flash Player ignores all of the custom tab order assignments. You should, therefore, provide a complete tab order for all accessible objects. Additionally, all objects assigned to a tab order, except frames, must have an instance name specified in the Instance Name text box of the Property inspector. Even items that are not tab stops, such as text, need to be included in the tab order if they are to be read in that order.

Because static text cannot be assigned an instance name, it cannot be included in the list of the tabIndex property values. As a result, a single instance of static text anywhere in the movie causes the reading order to revert to the default.

To specify a tab order, you assign an order number to the tabIndex property, as in the following example:

_this.myOption1.btn.tabIndex = 1
_this.myOption2.txt.tabIndex = 2

See Button.tabIndex, MovieClip.tabIndex, and TextField.tabIndex.

You can also use tabChildren or tabEnabled methods to assign custom tab order. See MovieClip.tabChildren, MovieClip.tabEnabled, and TextField.tabEnabled.