Archive for August, 2008

Make ILOG elixir charts accessible

During the last 360|Flex at San Jose I have had the opportunity to talk about Flex and Accessibility. One of the samples I worked on is the exposure of the information stored inside the Organization ChartĀ  to the screen reader.

The experience was amazing for me because the ILOG elixir charts source code is well written and arranged in a good way, that’s the reason why the process to make the information accessible to the screen reader was so easy and quick.

At the end of this entry you can find the slides and the link to the ILOG elixir accessible demo (source view enabled) and here you can find a preview of the new accessibility Flex documentation.

In theĀ  Organization Chart component I did a lot of changes…

Basically what I did is to make the component aware of TAB navigation, this means that when it get the focus it forces the player to navigate through the TAB the items rendered inside it

override public function setFocus():void{

super.setFocus();

// Diable the other component in order to keep here the focus
// -> better implementation is required!
this.dispatchEvent(new HandleTabEnabled(false, this));

// Get the first item selected in the chart
var ir:IListItemRenderer = _container.getChildAt(2) as IListItemRenderer;
var data:Object = getWrappedData(ir.data);

// Force the selection of the first item
dispatchChangeEvent(data, ir, new MouseEvent(MouseEvent.CLICK));

// Update the information stored for the screen reader
if((this.getItemRenderer(data) as AccessibleChartRenderer)){

if(Accessibility.active){

this.accessibilityProperties.name = (this.getItemRenderer(data)
as AccessibleChartRenderer).accessibilityProperties.name;
this.accessibilityProperties.description =
(this.getItemRenderer(data) as
AccessibleChartRenderer).accessibilityProperties.description;
flash.accessibility.Accessibility.updateProperties();

}

}

The method disable the other component in order to keep here the focus, get the first item selected in the chart and update the information stored for the screen reader.

In order to handle the TAB enabling I created a custom event with which I set enabled or disabled the tabEnabled property on all the componensts but not on the one that get the focus

// Code needs to be optimized for a real production
private function onHandlingTab(e:HandleTabEnabled):void{

for(var i:int = 0; i < this.parentApplication.numChildren; i++){

if(this.parentApplication.getChildAt(i) is IFocusManagerComponent){

(this.parentApplication.getChildAt(i) as UIComponent).tabEnabled
= e.isEnabled;

}

}

}

Another small change I did is in the keyEventHandler method that now is able to get the TAB key pressure and move to the next item updating the information stored inside MSAA

// Move down the focus
moveFocus("down");

// Update the screen reader informations
if(this.getItemRenderer(actualItemData) as AccessibleChartRenderer){

if(Accessibility.active){

this.accessibilityProperties.name = (this.getItemRenderer(actualItemData) as
AccessibleChartRenderer).accessibilityProperties.name;
this.accessibilityProperties.description = (this.getItemRenderer(actualItemData) as
AccessibleChartRenderer).accessibilityProperties.description;

Accessibility.updateProperties();

}

}

break;

For future implementations I added to the ItemRendererCache class the capability to define the tabIndex property of each component rendered inside the all ILOG elixir framework.
A greater testing and research may bring us to more advanced solutions for the accessibility enhancement of these components (i.e. focus handling).

Here you can find the demo and here the slides, a good question I received during the conference was about the possibility to ask to impaired user to disable the screen reader and put into the Flash Player the captions, the audio content, etc. I’m pretty sure that is a good point to discuss also if it’s not a standard way…

Flex and Dictionary class

Today I have had the opportunity to play a lot with Flex and the Dictionary class.

In ActionScript 2.0 when i needed something very simple to hold my data, I used pure Objects or their subclasses with bunch of methods, now we have more specialized class for this – flash.utils.Dictionary.
The Dictionary class lets you create a dynamic collection of properties, which uses strict equality (===) for key comparison on non-primitive object keys.

What I need today was a class able to handle a Dictionary in order to solve this tasks:

  1. The items added to Dictionary needs to auto define their key
  2. The class needs to keep a reference to a Class used as a “map” in order to be sure that when I search for a specific property inside the items I’m not making a mistake
  3. Return the value of a specific property of an item
  4. Get a list of all the items stored in the dictionary

The result is a class named DictionaryUtility that get a class definition, maps this definition to an object exploring the accessor methods and the public property of the class and that create a Dictionary dinamically.
In order to get the class definition I have used the utils package

var description:XML = flash.utils.describeType(classMap);

In order to recover the items collected in the Dictionary I used a simple for…in loop and the ArrayCollection class

public function getEntries():ArrayCollection {

   var list:ArrayCollection = new ArrayCollection();

    for (var key:* in dictionary){

	list.addItem(dictionary[key]);

    }

   return list;

}

The sample is available here and the source is here, I hope that someone may get some inspiration or help from this.

ActionScript 3.0 binary data

In the last months I have had the opportunity to play with this kinds of things in two real projects. The first opportunity was to play with music and to create some nice effects that reacts to the music, the second one was the creation of an AIR widget for the ftp of large files that can be launched from a web page.

In this short post I want to share this samples (source view enabled) that I created for the Cartier project:

http://www.mxml.it/samples/spiralizerMusic/spiralizerMusic.html
http://www.mxml.it/samples/soundspiral/SoundSpiral.html

Each samples plays with ByteArrays, SoundMixer.computeSpectrum and a lot of fantasy, hope that this files will be useful for others developers.