[ https://issues.apache.org/jira/browse/FLEX-35056?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15217177#comment-15217177 ]
Justin Mclean commented on FLEX-35056: -------------------------------------- Can reproduce in 4.14 and 4.15 SDKs. Code to reproduce: {code} <?xml version="1.0" encoding="utf-8"?> <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"> <fx:Script> <![CDATA[ import spark.components.Alert; protected function clicked(event:MouseEvent):void { Alert.show("msg", "title", Alert.YES | Alert.CANCEL, this, null, null, Alert.CANCEL); } ]]> </fx:Script> <mx:Button label="Click" click="clicked(event)" /> </s:Application> {code} > 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 > Assignee: Justin Mclean > 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)