1 | package gov.va.med.edp.util
|
---|
2 | {
|
---|
3 | import flash.accessibility.Accessibility;
|
---|
4 | import flash.accessibility.AccessibilityProperties;
|
---|
5 | import flash.utils.setTimeout;
|
---|
6 |
|
---|
7 | import mx.core.UIComponent;
|
---|
8 |
|
---|
9 |
|
---|
10 | [Bindable]
|
---|
11 | public class AccessibilityTools
|
---|
12 | {
|
---|
13 |
|
---|
14 | //----------------------------------------------------------------
|
---|
15 | //
|
---|
16 | // Class constants
|
---|
17 | //
|
---|
18 | //-----------------------------------------------------------------
|
---|
19 |
|
---|
20 | private static const ACC_READ_DELAY:int = 2000;
|
---|
21 |
|
---|
22 |
|
---|
23 | /**
|
---|
24 | * Function: accessComponentName()
|
---|
25 | * Parameters:
|
---|
26 | * component:UIComponent - Screen component reference
|
---|
27 | * accessName:String - Text to be read by JAWS
|
---|
28 | * Description:
|
---|
29 | * Generic functionality for reading flex accessible components
|
---|
30 | * when JAWS accessible feature(508) is used.
|
---|
31 | * Created by: jtorreno
|
---|
32 | * Date: 2008.02.08
|
---|
33 | *
|
---|
34 | **/
|
---|
35 | public static function accessComponentName(component:UIComponent,
|
---|
36 | accessName:String): void
|
---|
37 | {
|
---|
38 |
|
---|
39 | if ((component != null) && (accessName != null)) {
|
---|
40 | component.accessibilityProperties =
|
---|
41 | new AccessibilityProperties();
|
---|
42 | component.accessibilityProperties.name = accessName;
|
---|
43 |
|
---|
44 | setTimeout(updateAccessibleProperties, ACC_READ_DELAY);
|
---|
45 | }
|
---|
46 |
|
---|
47 | }
|
---|
48 |
|
---|
49 | /**
|
---|
50 | * Function: updateAccessibleProperties()()
|
---|
51 | * Parameters:
|
---|
52 | * NONE
|
---|
53 | * Description:
|
---|
54 | * Generic functionality for updating accessible properties
|
---|
55 | * when JAWS accessible feature(508) is used.
|
---|
56 | * Created by: jtorreno
|
---|
57 | * Date: 2008.02.15
|
---|
58 | *
|
---|
59 | **/
|
---|
60 |
|
---|
61 | private static function updateAccessibleProperties(): void
|
---|
62 | {
|
---|
63 | if (Accessibility.active) {
|
---|
64 | Accessibility.updateProperties();
|
---|
65 | }
|
---|
66 | }
|
---|
67 |
|
---|
68 | /**
|
---|
69 | * Function: accessComponentDescription()
|
---|
70 | * Parameters:
|
---|
71 | * component:UIComponent - Screen component reference
|
---|
72 | * accessName:String - Text to be read by JAWS
|
---|
73 | * Description:
|
---|
74 | * Generic functionality for reading flex accessible components
|
---|
75 | * when JAWS accessible feature(508) is used.
|
---|
76 | * Created by: jtorreno
|
---|
77 | * Date: 2008.02.08
|
---|
78 | *
|
---|
79 | **/
|
---|
80 | public static function accessComponentDescription(
|
---|
81 | component:UIComponent, accessName:String): void
|
---|
82 | {
|
---|
83 |
|
---|
84 | if ((component != null) && (accessName != null)) {
|
---|
85 | component.accessibilityProperties =
|
---|
86 | new AccessibilityProperties();
|
---|
87 | component.accessibilityProperties.description = accessName;
|
---|
88 |
|
---|
89 | setTimeout(updateAccessibleProperties, ACC_READ_DELAY);
|
---|
90 | }
|
---|
91 |
|
---|
92 | }
|
---|
93 |
|
---|
94 | /**
|
---|
95 | * Function: accessAppViewHeader()
|
---|
96 | * Parameters:
|
---|
97 | * component:UIComponent - Screen component reference
|
---|
98 | * tabIndex:int - Tab index to be read by JAWS
|
---|
99 | * Description:
|
---|
100 | * Reads application header when JAWS accessible
|
---|
101 | * feature(508) is used.
|
---|
102 | * Created by: jtorreno
|
---|
103 | * Date: 2008.02.12
|
---|
104 | *
|
---|
105 | **/
|
---|
106 | public static function accessAppViewHeader(component:UIComponent,
|
---|
107 | tabIndex:int):void
|
---|
108 | {
|
---|
109 |
|
---|
110 | if ((component != null) && (tabIndex >= 0)) {
|
---|
111 | component.accessibilityProperties =
|
---|
112 | new AccessibilityProperties();
|
---|
113 | component.focusEnabled = true;
|
---|
114 | component.tabIndex = tabIndex;
|
---|
115 |
|
---|
116 | setTimeout(updateAccessibleProperties, ACC_READ_DELAY);
|
---|
117 | }
|
---|
118 |
|
---|
119 | }
|
---|
120 |
|
---|
121 | /**
|
---|
122 | * Function: isAccessibilityToolActive()
|
---|
123 | * Parameters:
|
---|
124 | * NONE
|
---|
125 | * Description:
|
---|
126 | * Checks if accessibility tool is active.
|
---|
127 | * Return:
|
---|
128 | * Returns false if JAWS reader is active
|
---|
129 | * Created by: jtorreno
|
---|
130 | * Date: 2008.04.1
|
---|
131 | *
|
---|
132 | **/
|
---|
133 | public static function setToFalseIfAccessToolIsActive():Boolean
|
---|
134 | {
|
---|
135 | var bActive:Boolean = true;
|
---|
136 |
|
---|
137 | if (isAccessibilityActive()) {
|
---|
138 | bActive = false;
|
---|
139 | }
|
---|
140 | return bActive;
|
---|
141 | }
|
---|
142 |
|
---|
143 | public static function isAccessibilityActive():Boolean
|
---|
144 | {
|
---|
145 | // return true;
|
---|
146 | return Accessibility.active;
|
---|
147 | }
|
---|
148 | }
|
---|
149 | }
|
---|