Comunidad de diseño web y desarrollo en internet online

Leyendo y no leyendo los elementos de un DataGrid

Citar            
MensajeEscrito el 17 Dic 2008 12:43 am
Si contruyo un DataGrid con el Objeto definido de esta forma:

Código ActionScript :

function btnAdicionar_CLICK ( evento:MouseEvent ):void
{
   var nuevoItem:Object = 
   {
      id: idValor,
      producto: productoValor,
      cant: cantValor,
   }
   dtgCarrito.addItem( nuevoItem ); 
}


Puedo leer por ejemplo el primer elemento de la lista de productos de la siguiente forma:

Código ActionScript :

function btnLeer_CLICK ( e:MouseEvent ):void
{
   trace( dtgCarrito.getItemAt(0).producto );
}


Hasta allí todo ok. Pero si yo construyo el Objeto con el constructor new así

Código ActionScript :

function btnAdicionar_CLICK ( evento:MouseEvent ):void
{
   var nuevoItem:Object = new Object();
   {
      nuevoItem.id: idValor,
      nuevoItem.producto: productoValor,
      nuevoItem.cant: cantValor,
   }
   dtgCarrito.addItem( nuevoItem ); 
}


cuando tento leer de esta forma:

Código ActionScript :

function btnLeer_CLICK ( e:MouseEvent ):void
{
   trace( dtgCarrito.getItemAt(0).nuevoItem.producto );
}


Recibo un error diciendo que debe ser un identificador simple. Alguien sabe como resolver este problema?

Desde ya muchas gracias. Claudio

Por Ishkandar

Claber

303 de clabLevel



Genero:Masculino  

firefox
Citar            
MensajeEscrito el 17 Dic 2008 01:29 am
Para que funcione lo correcto es tracear así:

Código ActionScript :

function btnLeer_CLICK ( e:MouseEvent ):void 
{ 
   trace( dtgCarrito.getItemAt(0).producto ); 
}


Claudio

Por Ishkandar

Claber

303 de clabLevel



Genero:Masculino  

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.