[ https://issues.apache.org/jira/browse/FLEX-27648?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Justin Mclean updated FLEX-27648: --------------------------------- Labels: easyfix easytest (was: ) > ViewStack.getItemIndex() throws error instead of returning -1 when item is > not a child of the ViewStack > ------------------------------------------------------------------------------------------------------- > > Key: FLEX-27648 > URL: https://issues.apache.org/jira/browse/FLEX-27648 > Project: Apache Flex > Issue Type: Bug > Components: mx: View Stack > Affects Versions: Adobe Flex SDK Previous > Environment: Affected OS(s): Windows > Affected OS(s): Windows > Browser: Other (specify version) > Language Found: English > Reporter: Adobe JIRA > Labels: easyfix, easytest > > Steps to reproduce: > 1. create a ViewStack with no children and call getItemIndex() > <fx:Script> > <![CDATA[ > import mx.controls.Alert; > protected function init(event:Event):void > { > try > { > event.target.getItemIndex(this); > Alert.show("no error","ok"); > } > catch (e:ArgumentError) > { > Alert.show(e.message,"a ha!"); > } > } > ]] > > > </fx:Script> > <mx:ViewStack initialize="init(event)" /> > > Actual Results: > An ArguementError with message "Error #2025: The supplied DisplayObject must > be a child of the caller." is thrown > > > Expected Results: > -1 should be returned as specified by mx.collections.IList.getItemIndex() > "Returns int - The index of the item, or -1 if the item is not in the list. " > > > Workaround (if any): > > A try/catch like above can be used as a work around but ideally this can be > fixed directly in ViewStack so subclasses like TabNavigator are not affected. > Proposed fix: > public function getItemIndex(item:Object):int > { > if (contains(item as DisplayObject)) > { > return getChildIndex(item as DisplayObject); > } > else > { > return -1; > } > } > -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira