I'm trying to add accessibility to my application. I still can't figure out exactly how accessibility works in spark components.
I'm on window's platform with the narrator function enabled.
All I want to do is to name the three fields with a different name for accessibility so the user knows what to do.
I tried to just use declaration to define the accessibility properties but it seems like it will always only speak out one name of the button. Thus, I took another approach and tried to create the accessibility properties when it does the creation complete. It seems like the narrator is sometimes picking up the correct name of the accessibility in the beginning, then very soon, when I goto the button, it'll replace all the name and call it "search button". Any idea why?!?! I'm very puzzled. Any help will be appreciated.
<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:accessbility="flash.accessibility.*" initialize="onInit()" creationComplete="onComplete()">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<fx:Script>
<![CDATA[
import com.modernista.swffocus.SWFFocus;
private function onComplete():void {
var ap1:AccessibilityProperties = new AccessibilityProperties();
ap1.name = "search";
searchInput.accessibilityProperties = ap1;
var ap2:AccessibilityProperties = new AccessibilityProperties();
ap2.name = "name input";
nameInput.accessibilityProperties = ap2;
var sb:AccessibilityProperties = new AccessibilityProperties();
sb.name = "search button";
searchSubmit.accessibilityProperties = sb;
Accessibility.updateProperties();
}
// this helps Firefox capture and release keyboard focus
private function onInit():void {
SWFFocus.init(systemManager.stage as Stage);
}
]]>
</fx:Script>
<mx:Form defaultButton="{searchSubmit}">
<mx:HBox width="100%" height="100%" horizontalAlign="center" verticalAlign="middle" >
<mx:TextInput id="searchInput" width="540">
</mx:TextInput>
<mx:TextInput id="nameInput" width="540">
</mx:TextInput>
<mx:Button id="searchSubmit" label="search" />
</mx:HBox>
</mx:Form>
</s:WindowedApplication>