Removing objects / components

Flash, Flex Add comments

This is pretty easy, but also pretty usefull.

It removes all the children of a given object. You can use with Flex or Flash.

/**************************************/

Muito fácil, mas também muito útil.

Remove todos os filhos de um dado objeto. Você pode usar com Flex ou Flash.

/**************************************/

[code lang="actionscript"] package com.util {
import flash.display.DisplayObjectContainer;public class RemoveChildren    {

public static function removeAll(owner:DisplayObjectContainer):void{
var j:int=owner.numChildren;

while (j - -){
owner.removeChildAt(j);
}
}

}
}[/code]

4 Responses to “Removing objects / components”

  1. Rui Says:

    Bom dia… porque não usar o owner.removeAllChildren?

    gostava de falar mais consigo :)

  2. gabrielaperry Says:

    Sim, também pode ser :0)

  3. gabriela Says:

    Ah, sabia que tinha um bom motivo para ser assim: não tem removeAllChildren no flash…
    :0)

  4. Alexandre Brito Says:

    Obrigado, você salvou uma vida.

Leave a Reply

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in