Hola,

Bueno hubiera preferido subir los archivos pero...

en la Timeline:


capa1,codigo siguiente:

Código :

// sabado 15 de enero de 2005
// autor: Mike / [email protected] 
//
import mx.controls.gridclasses.DataGridColumn

function init_grid(){

   var column: DataGridColumn = new DataGridColumn("preview")
   column.headerText = "Preview"
   column.width = 160
   column.cellRenderer = "imageCellRender" // [image] cell renderer
   grid.addColumn(column)
   
   var column: DataGridColumn = new DataGridColumn("id")
   column.headerText = "Item ID"
   column.width = 100
   grid.addColumn(column);
   
   grid.resizableColumns = false; // bug en disposicion de las imagenes en caso de "resize"
} 

init_grid();

grid.dataProvider = [{preview:"imagen1.jpg",id:"imagen1.jpg"},{preview:"imagen2.jpg",id:"imagen2.jpg"},{preview:"imagen3.jpg",id:"imagen3.jpg"},{preview:"imagen4.jpg",id:"imagen4.jpg"},{preview:"imagen5.jpg",id:"imagen5.jpg"}];



capa2, un datagrid con nombre de instancia "grid"

en la biblioteca:

Datagrid
Loader
imageCellRender ( movieclip con linkage & AS 2.0 Class: "imageCellRender")
imageCont ( movieclip )

imageCont esta dentro de imageCellRender en 0,0 con nombre de instancia "img"

Ahora el codigo de la clase imageCellRender.as:

Código :

import mx.core.UIComponent;
import mx.controls.Loader

class imageCellRender extends UIComponent {

   var img:MovieClip;
   var url:String;
   
   var owner;
   // The row that contains this cell
   var listOwner:MovieClip;
   // the reference we receive to the list
   var getCellIndex:Function;
   // the function we receive from the list
   var getDataLabel:Function;
   // the function we receive from the list
   var firstSizeCompleted:Boolean;
   
   
   function IconCellRenderer() 
   {
   }
   
    function createChildren(Void):Void 
    {
       firstSizeCompleted = false;
       img = createObject("Loader", "Img", 1, {styleName:this, owner:this});
       img.addEventListener("complete", this);
       //img = createObject("imageCont", "Img", 1, {styleName:this, owner:this});
       //size();
    }
    
    function size(Void) : Void
   {
      var h = __height;
      var w = __width;      
      
      if (img != undefined) 
      {
         img._x = (w - img._width)/2;
         img._y = (0 - img._height)/2;
         
         if(!firstSizeCompleted) 
         {
         //img._y = (0 - img._height)/2;      
         }
         else
         {
         //img._y = (0 - img._height)/2;
         }
      firstSizeCompleted = true;   
      }
   }   
   
    function setValue(str:String, item:Object, sel:Boolean):Void 
    {      
    
      var h = __height;
      var w = __width;
      
      //visible only if value loaded
       img._visible = (item[getDataLabel()] != undefined);
       
       if(item[getDataLabel()] != this.url)// prevent reload image!
      {    
         img.autoload = false;
          img.load(item[getDataLabel()]);
          img.scaleContent=false;      
          //size();
          this.url = item[getDataLabel()]// store image loaded
       }      
    }
    

    
    function complete()
    { 
       size();
       img._visible = true;
    }

}


y finalmente 5 imagenes jpg ..

nb: no olvidar poner el punto de registro (symbol position) de los movieclips centrado.

Ahora los problemas:

No consiguo inicializar correctamente las imagenes cargadas.
Aparecen primero no centradas pero al mover las columnas el Datagrid las vuelve a poner en el centro como se espera.
Cuando hago lo necesario para que las imagenes se inicialicen centradas, despues al mover las columnas, el Datagrid rompe la disposicion.
arghhhhh!

Para terminar, aperece la instancia de una imagen donde no deberia (al final del Datagrid cuando se hace un scrolldown completo)

Pues es todo...
Un saludo, Mike.