Hi, i'm having the following problem with my custom TreeItemRenderer. I have 3
kinds of nodes. Company (tipo = 0), User (Tipo = 1) and Permission(Tipo = 2).
All kinds have a checkbox and the user and permission types have custom icons.
When i open and close the branches manualy or with as scrips some of my custom
icons disapper or appear on wrong places. If somebody knows the solution for my
issue I would be very thankful.

Thanks,
Peter

package com.util.renderers {
import flash.events.MouseEvent;

import mx.collections.*;
import mx.controls.CheckBox;
import mx.controls.Image;
import mx.controls.treeClasses.*;

public class xTreeRendererChk extends TreeItemRenderer {

[Embed(source="/assets/imagens/iconChave.png")]
private var iconeChave:Class;
[Embed(source="/assets/imagens/iconSelUsuario2.png")]
private var iconeUsuario:Class;
private var icone:Image;

private var check:CheckBox;


public function xTreeRendererChk() {
super();
}

//FUN플O QUE SOBREESCREVE O METODO CREATECHILDREN CRIA OS CHECKS
override protected function createChildren():void {
super.createChildren();
check = new CheckBox();
icone = new Image();
check.addEventListener(MouseEvent.CLICK,selecionar Check)
addChild(icone);
addChild(check);

if(super.data){
check.visible = Boolean(int(TreeListData(super.listData).item.chk ));

if(TreeListData(super.listData).item.tipo == '0'){
this.icone.visible = false;
}else if(TreeListData(super.listData).item.tipo == '1'){
this.icone.source = iconeUsuario;
super.icon.visible = false;
}else if(TreeListData(super.listData).item.tipo == '2'){
this.icone.source = iconeChave;
super.icon.visible = false;
}
}
}

//FUN플O QUE SOBREESCREVE O METODO SET DATA
override public function set data(value:Object):void {
super.data = value;
}

//FUN플O QUE SOBREESCREVE O METODO COMMITPROPERTIES
override protected function commitProperties():void
{
super.commitProperties();

if(super.data){

check.visible = Boolean(int(TreeListData(super.listData).item.chk ));

if(TreeListData(super.listData).item.tipo == '0'){
this.icone.visible = false;
}else if(TreeListData(super.listData).item.tipo == '1'){
this.icone.source = iconeUsuario;
super.icon.visible = false;
}else if(TreeListData(super.listData).item.tipo == '2'){
this.icone.source = iconeChave;
super.icon.visible = false;
}
}

}


//FUN플O QUE SOBREESCREVE O METODO UPDATEDISPLAYLIST POSICIONA OS
DISPLAYOBJECTS
override protected function updateDisplayList(unscaledWidth:Number,
unscaledHeight:Number):void {

super.updateDisplayList(unscaledWidth, unscaledHeight);
if(super.data) {

super.label.text = TreeListData(super.listData).label;
this.check.selected =
Boolean(TreeListData(super.listData).item.selecio nado == '1');
this.check.y = 9;
if(TreeListData(super.listData).item.tipo == '0'){
this.check.x = super.icon.x;
super.icon.x = this.check.x + 19
super.label.x = super.icon.x + 18;
}else if(TreeListData(super.listData).item.tipo == '1'){
this.check.x = super.icon.x;
this.icone.width = 14;
this.icone.height = 14;
this.icone.x = this.check.x + 19;
super.label.x = this.icone.x + 18;
}else if(TreeListData(super.listData).item.tipo == '2'){
this.check.x = super.icon.x;
this.icone.width = 14;
this.icone.height = 14;
this.icone.x = this.check.x + 19;
super.label.x = this.icone.x + 18;
}
}
}



//FUN플O QUE MARCA/DESMARCA OS CHECKS
private function selecionarCheck(Event:MouseEvent):void{
if(Boolean(int(TreeListData(super.listData).item. selecionado))){
TreeListData(super.listData).item.selecionado = '0';
for(var i:int = 0; i <
TreeListData(super.listData).item.descendants().le ngth(); i++){
TreeListData(super.listData).item.descendants()[i].selecionado = '0';
}
}else{
TreeListData(super.listData).item.selecionado='1'
for(var j:int = 0; j <
TreeListData(super.listData).item.descendants().le ngth(); j++){
TreeListData(super.listData).item.descendants()[j].selecionado = '1';
}
}
}
}
}