nnnnngh
authorRichard Fairhurst <richard@systemed.net>
Wed, 16 Jun 2010 09:56:59 +0000 (09:56 +0000)
committerRichard Fairhurst <richard@systemed.net>
Wed, 16 Jun 2010 09:56:59 +0000 (09:56 +0000)
net/systemeD/halcyon/MapPaint.as

index e67d290..9c4f132 100644 (file)
@@ -83,10 +83,14 @@ package net.systemeD.halcyon {
                                }
                        
                                // update index
+                               // (we do it in this rather indirect way because if you alter sublayerIndex directly
+                               //  within the loop, it confuses the iterator)
+                               var toUpdate:Array=[];
                                for (index in sublayerIndex) {
                                        ix=Number(index);
-                                       if (ix>sublayer) { sublayerIndex[index]++; }
+                                       if (ix>sublayer) { toUpdate.push(index); }
                                }
+                               for each (index in toUpdate) { sublayerIndex[index]++; }
                                sublayerIndex[sublayer]=lowestAbovePos;
                        }