Uploaded image for project: 'Apache Flex'
  1. Apache Flex
  2. FLEX-35056

Pressing escape on s:Alert causes a RangeError when Alert.CANCEL is passed as defaultButtonFlag

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • Apache Flex 4.14.0
    • Apache Flex 4.16.0
    • None
    • None
    • Mac OSX 10.9, AIR20, IntelliJ IDEA

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

              jmclean Justin Mclean
              dkarten Dylan Karten
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: