Lisichenko / as3isolib

Automatically exported from code.google.com/p/as3isolib
0 stars 0 forks source link

Node:removeChildByID duplicates Node:getChildIndex functional #50

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Node:removeChildByID duplicates Node:getChildIndex functional inside it.

What is the expected output? What do you see instead?

Node:removeChildByID should use Node:getChildIndex for searching in 
childrenArray.

What version of the product are you using? On what operating system?

as3isolib.v1.core

Please provide any additional information below.

-               //remove from children array
-               var i:uint;
-               
-               for ( i; i < childrenArray.length; i++ )
-               {
-                   if ( child == childrenArray[ i ])
-                   {
-                       childrenArray.splice( i, 1 );
-                        delete childrenIdDict[child.id];
-                       break;
-                   }
-               }

+                var childIndex:int = getChildIndex(child);
+                
+                if (childIndex >= 0) {
+                    childrenArray.splice(childIndex, 1);
+                }

Original issue reported on code.google.com by maxim.ga...@gmail.com on 4 Nov 2012 at 2:00