Dylan Karten created FLEX-35056:
-----------------------------------

             Summary: Pressing escape on s:Alert causes a RangeError when 
Alert.CANCEL is passed as defaultButtonFlag
                 Key: FLEX-35056
                 URL: https://issues.apache.org/jira/browse/FLEX-35056
             Project: Apache Flex
          Issue Type: Bug
    Affects Versions: Apache Flex 4.14.0
         Environment: Mac OSX 10.9, AIR20, IntelliJ IDEA
            Reporter: Dylan Karten
            Priority: Minor


If I create an alert with the static method Alert.show("msg", "title", 
Alert.YES | Alert.CANCEL, this, closeHandler, null, Alert.CANCEL) and press the 
escape key when the Alert is open, I get the following error

RangeError: Error #1125: The index 8 is out of range 2. 
at 
spark.components::Alert/onKeyDown()[/Users/erik/Documents/ApacheFlex/git/flex-sdk4.14.1/frameworks/projects/experimental/src/spark/components/Alert.as:841]

The error occurs in the onKeyDown function in spark.components.Alert.as:

private function onKeyDown(e:KeyboardEvent):void {
    if (e.charCode == Keyboard.ESCAPE) {
        removeAlert(identifyButton(_buttons[ _defaultButtonFlag ] as Button));
    }
}

A workaround is to not pass Alert.CANCEL as the defaultButtonFlag, BUT this 
prevents the enter key from defaulting to the Cancel button, which is desired.




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to