You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ah...@apache.org on 2018/11/06 21:00:18 UTC

[royale-asjs] 02/04: fix how addingChild/childrenAdded work

This is an automated email from the ASF dual-hosted git repository.

aharui pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git

commit 7b88be278d989987a3b9771ff359061497779285
Author: Alex Harui <ah...@apache.org>
AuthorDate: Tue Nov 6 12:59:10 2018 -0800

    fix how addingChild/childrenAdded work
---
 .../MXRoyale/src/main/royale/mx/core/UIComponent.as         | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as b/frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as
index c6e044e..052d8dd 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as
@@ -3092,7 +3092,8 @@ COMPILE::JS
     { override }
     public function $addChild(child:IUIComponent):IUIComponent
     {
-        return addElement(child) as IUIComponent;
+        // this should avoid calls to addingChild/childAdded
+        return super.addElement(child) as IUIComponent;
     }
 
     /**
@@ -3105,7 +3106,6 @@ COMPILE::JS
     public function addChildAt(child:IUIComponent,
                                         index:int):IUIComponent
     {
-        // this should probably call addingChild/childAdded
         return addElementAt(child, index) as IUIComponent;
     }
     
@@ -3115,7 +3115,10 @@ COMPILE::JS
     public function $addChildAt(child:IUIComponent,
                                index:int):IUIComponent
     {
-        return addElementAt(child, index) as IUIComponent;
+        // this should avoid calls to addingChild/childAdded
+        if (index >= super.numElements)
+            return super.addElement(child) as IUIComponent;
+        return super.addElementAt(child, index) as IUIComponent;
     }
 
     /**
@@ -3136,7 +3139,7 @@ COMPILE::JS
     public function $removeChild(child:IUIComponent):IUIComponent
     {
         // this should probably call the removingChild/childRemoved
-        return removeElement(child) as IUIComponent;
+        return super.removeElement(child) as IUIComponent;
     }
     
     COMPILE::JS
@@ -3162,7 +3165,7 @@ COMPILE::JS
     { override }
     public function $removeChildAt(index:int):IUIComponent
     {
-        return removeElement(getElementAt(index)) as IUIComponent;
+        return super.removeElement(getElementAt(index)) as IUIComponent;
     }
 
     /**