Bug fix - AbstractItem.cleanup()

0 views
Skip to first unread message

jpjj05...@yahoo.com

unread,
May 27, 2008, 6:36:04 PM5/27/08
to APE General
When removing items, works better to*downcount* the array:

<code>
public function cleanup():void {
sprite.graphics.clear();
var n = sprite.numChildren;
for (var i:int = n-1; i >= 0; i--) {
sprite.removeChildAt(i);
}
}
</code>
[else you only remove the alternate/half of elements...]

Owen Bennett

unread,
May 27, 2008, 6:57:41 PM5/27/08
to ape-g...@googlegroups.com
Or you can just use sprite.removeChildAt(0)

motionsmith

unread,
May 29, 2008, 9:09:52 PM5/29/08
to APE General
Thanks!

On May 27, 3:57 pm, Owen Bennett <o...@steamboy.co.uk> wrote:
> Or you can just use sprite.removeChildAt(0)
>
Reply all
Reply to author
Forward
0 new messages