From the archive
http://EmpowermentZone.com/flex_fruit.zip

This fruit basket program is developed with the Adobe Flex 4 framework.  It uses Flash Player as a virtual machine to run code compiled from one of two languages (or a combination of them):  ActionScript -- similar to JavaScript -- or MXML -- a declarative markup language.  The compiled code, FruitBasket.swf, is hosted in a web page, FruitBasket.htm, which serves as a wrapper for the app.  Flash Player 10 is required on the client computer.  Supported web browsers are Internet Explorer and Firefox.

The free Flex 4 SDK is available in a zip archive from
http://OpenSource.adobe.com

It includes a command-line compiler, mxmlc.exe.  There are two versions of the source code:  FruitBasket.mxml and FruitBasket.as, using the MXML approach and the ActionScript approach, respectively.  The batch files BuildMXML.bat and BuildAS.bat compile these files, creating FruitBasket.swf (the extension stands for ShockWave Flash) in either case.

Please note, however, that although FruitBasket.as compiles, the code evidently still needs some tweaking because the app does not work properly.  The code is left in this distribution in case others may learn from it and take it furhter.

This app tries to follow best practices in developing accessible Flex apps, as explained at
http://adobe.com/accessibility

These practices include specifying either accessibility or silence for certain controls, assigning accessible names to controls, specifying their tab order, and supporting keyboard shortcuts.  In this case, the keyboard shortcuts include Enter to click the Add button, Shift+Delete to click the Delete button, Control+PageUp to focus on the first control, and Control+PageDown to focus on the last one.

The white paper on Flex 4 accessibility best practices is located at
http://blogs.adobe.com/accessibility/files/2011/03/Flex-4-Accessibility-Best-Practices.pdf

SSB BART Group has developed scripts for JAWS 8, 9, or 10 that improve the accessibility of Flex apps with that screen reader:
http://www.ssbbartgroup.com/clients/adobe/jfw_flex_263.exe

A collection of text tutorials about Flex development -- saved from public web pages -- is available at
http://EmpowermentZone.com/flex_doc.zip

Screen readers vary significantly in in their client-side support for Flex accessibility.  It may be necessary to manually turn off a virtual or browse mode in order to interact with the app.  To try it, open the embedding HTML file, either locally after unzipping the archive, or via the following web address:
http://EmpowermentZone.com/FruitBasket.htm

The archive will soon be available on
http://FruitBasketDemos.org

For convenient reference, the FruitBasket.mxml code is also pasted below.

Jamal Mazrui

<?xml version="1.0" encoding="utf-8"?>
<!-- Public domain fruit basket program in MXML
By Jamal Mazrui on April 20, 2011 -->
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" 
minWidth = "955" minHeight = "600" creationComplete = "initApp()">

<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>

<!-- Place UI components here -->
<s:HGroup id = "hgrpAdd" accessibilityEnabled = "true">
<s:Label id = "lblFruit" accessibilityEnabled = "false" text = "Fruit:" tabEnabled = "false"/>
<s:TextInput id = "txtFruit" accessibilityEnabled = "true" accessibilityName = "Fruit:" tabIndex = "1"/>
<s:Button id = "btnAdd" accessibilityEnabled = "true" label = "Add" tabIndex = "2" click = "addFruit();"/>
</s:HGroup>

<s:HGroup id = "hgrpDelete" accessibilityEnabled = "true">
<s:Label id = "lblBasket" accessibilityEnabled = "false" text = "Basket:" tabEnabled = "false"/>
<s:List id = "lstBasket" accessibilityEnabled = "true" accessibilityName = "Basket:" tabIndex = "3">
<s:dataProvider>
<mx:ArrayList> 
</mx:ArrayList>
</s:dataProvider>
</s:List>  

<s:Button id = "btnDelete" accessibilityEnabled = "true" label = "Delete" tabIndex = "4" click = "deleteFruit();"/>
</s:HGroup>

<!-- Place ActionScript event handlers here -->
<fx:Script>
<![CDATA[
import mx.controls.Alert;

private function initApp(): void {
if (Capabilities.hasAccessibility && !this.accessibilityProperties) {
this.accessibilityProperties = new AccessibilityProperties();
this.accessibilityProperties.silent = false;
this.accessibilityProperties.forceSimple = false;
Accessibility.updateProperties();
}

this.defaultButton = btnAdd;
txtFruit.setFocus();
} // initApp method

private function addFruit():void {
var sFruit: String = txtFruit.text;
var iLength: int = sFruit.length;
if (iLength == 0) Alert.show("No fruit to add!", "Alert");
else {
lstBasket.dataProvider.addItem(sFruit);
var iIndex: int = lstBasket.dataProvider.length - 1;
lstBasket.selectedIndex = iIndex;
txtFruit.text = "";
}
} // addFruit method

private function deleteFruit(): void {
var iIndex: int = lstBasket.selectedIndex;
if (iIndex == -1) Alert.show("No fruit to delete!", "Alert");
else {
lstBasket.dataProvider.removeItemAt(iIndex);
var iLength:int = lstBasket.dataProvider.length;
if (iIndex == iLength) iIndex --;
if (iIndex >=0) lstBasket.selectedIndex = iIndex;
}
} // deleteFruit method
]]>
</fx:Script>
</s:Application>
