Try setting visible to false/true, is better than always removing adding the same thing (if that's what you are doing)
-Pete On Wed, Jan 27, 2010 at 5:07 PM, dp <[email protected]> wrote: > I've been messing around with adding and removing objects depending on > their proximity. However at the moment I suffer from constantly > deteriorating performance, even though the total faces remain at a > constant low level. I assume I'm not removing the objects correctly > but don't know how else? > > Im pretty stuck. thanks! > > > > private function proximity():void > { > > if ((obj.x >= oldX + 50 || obj.x <= oldX - 50) || > (obj.y >= oldY > +50 || obj.y <= oldY -50)) > { > for each ( var p:Plane in neighbors) > { > scene.removeChild(p); > } > > neighbors = sdb.getAllNeighbors(obj.x, > obj.y); > > for each ( p in neighbors) > { > scene.addChild(p) > } > > oldX = obj.x; > oldY = obj.y; > } > } > -- ___________________ Actionscript 3.0 Flash 3D Graphics Engine HTTP://AWAY3D.COM
