Updated Branches:
  refs/heads/develop 03759d771 -> 8c2658ac2

FLEX-27648 Stop RTE and correct as per IList interface


Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/8c2658ac
Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/8c2658ac
Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/8c2658ac

Branch: refs/heads/develop
Commit: 8c2658ac2f6fada57425913fad5bee74305c9f1c
Parents: 03759d7
Author: Justin Mclean <jmcl...@apache.org>
Authored: Tue Aug 20 13:04:27 2013 +1000
Committer: Justin Mclean <jmcl...@apache.org>
Committed: Tue Aug 20 13:04:27 2013 +1000

----------------------------------------------------------------------
 .../projects/mx/src/mx/containers/ViewStack.as       | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/8c2658ac/frameworks/projects/mx/src/mx/containers/ViewStack.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/mx/src/mx/containers/ViewStack.as 
b/frameworks/projects/mx/src/mx/containers/ViewStack.as
index bf462ca..2fc507e 100644
--- a/frameworks/projects/mx/src/mx/containers/ViewStack.as
+++ b/frameworks/projects/mx/src/mx/containers/ViewStack.as
@@ -1581,8 +1581,21 @@ public class ViewStack extends Container implements 
IHistoryManagerClient, ISele
      */
     public function getItemIndex(item:Object):int
     {
-        return getChildIndex(item as DisplayObject);
+               if (isValidChild(item as DisplayObject))
+               return getChildIndex(item as DisplayObject);
+               else
+                       return -1;
     }
+       
+       private function isValidChild(child:DisplayObject):Boolean {
+               for (var i:int = 0; i < numChildren; i++)
+               {
+                       if (getChildAt(i) == child)
+                               return true;
+               }
+               
+               return false;
+       }
 
     /**
      *  @private

Reply via email to