Mega Code Archive
Clearing selections
import flash.events.KeyboardEvent;
import mx.core.FlexGlobals;
import mx.collections.ArrayCollection;
[Bindable]
public var expenses:ArrayCollection = new ArrayCollection([
{Month:"Jan", Profit:20, Expenses:15, Amount:145},
{Month:"Feb", Profit:1, Expenses:2, Amount:60},
{Month:"Mar", Profit:15, Expenses:5, Amount:3}
]);
private function initApp():void {
FlexGlobals.topLevelApplication.addEventListener(KeyboardEvent.KEY_UP, keyHandler);
}
// Clears all chart items selected when the user presses the ESC key.
private function keyHandler(event:KeyboardEvent):void {
var curKeyCode:int = event.keyCode;
if (curKeyCode == 27) { // 27 is the keycode value for ESC
myChart.clearSelection();
}
}