![MACROMEDIA FLEX - DEVELOPING COMPONENTS AND THEMES Manual Download Page 71](http://html1.mh-extra.com/html/macromedia/flex-developing-components-and-themes/flex-developing-components-and-themes_manual_3388115071.webp)
Improving component usability
71
Making components accessible
A growing requirement for web content is that it should be accessible to people who have
disabilities. Visually impaired people can use the visual content in Flash applications by means of
screen reader software, which provides an audio description of the material on the screen.
When you create a component, you can include ActionScript that enables the component and a
screen reader to communicate. Then, when developers use your component to build an
application in Flash, they use the Accessibility panel to configure each component instance.
Flash MX 2004 includes the following accessibility features:
•
Custom focus navigation
•
Custom keyboard shortcuts
•
Screen-based documents and the screen authoring environment
•
An Accessibility class
To enable accessibility in your component, add the following line to your component’s class file:
mx.accessibility.
ComponentName
.enableAccessibility();
For example, the following line enables accessibility for the MyButton component:
mx.accessibility.MyButton.enableAccessibility();
When developers add the MyButton component to an application, they can use the Accessibility
panel to make it available to screen readers.
Improving component usability
After you create the component and prepare it for packaging, you can make it easier for your users
to use. This section describes some techniques for adding usability to your component.
Adding an icon
You can add an icon that represents your component in the Components panel of the Flash
authoring environment.
To add an icon for your component:
1.
Create an image with the following specifications:
■
18 pixels x 18 pixels
■
Saved in PNG format
■
8-bit with alpha transparency
■
A transparent upper-left pixel, to support masking
2.
Add the following definition to your component’s ActionScript class file before the class
definition:
[IconFile("
component_name
.png")]
3.
Add the image to the same directory as the FLA file.
When you export the SWC file, Flash includes the image at the root level of the archive.