Hola, aqui la segunda parte del script, ahora con dar click a la grid, se abre una ventana que depliega todos los datos, necesitas tener una instancia de Window en la Biblioteca, tambien una instancia de TextArea y una instancia de un movieclip vacio vinculado para AS con id "algo". y Listo
Código ActionScript :
function cellPress( ev:Object )
{
pressed = ev.target.getItemAt( ev.itemIndex );
if( pressed )
{
var win = PopUpManager.createPopUp(this, Window, true, {closeButton:true, contentPath:"algo", title:"Producto"});
win.addEventListener("click", this);
win.addEventListener("complete", this);
}
}
function click( ev:Object )
{
ev.target.deletePopUp();
}
function complete( ev:Object)
{
crearFicha( ev.target.content );
ev.target.setSize( ev.target.content._width + 5 , ev.target.content._height + 25);
ev.target.move((Stage.width - ev.target.width)/2, (Stage.height - ev.target.height)/2 );
}
function crearFicha( clip:MovieClip ):Void
{
setArea( clip.createEmptyMovieClip("bg", 0), 550, 330 );
var wo:MovieClip = clip.createEmptyMovieClip("wo", 1);
wo._y = wo._x = 5;
var ld:MovieClipLoader = new MovieClipLoader();
var ob:Object = new Object();
ob.onLoadInit = function( t:MovieClip ){ t._width = 260; t._height = 290; };
ld.addListener(ob);
wo.createEmptyMovieClip("ld", 0);
ld.loadClip("http://www.tres.com.uy/imagenes/productos/636.jpg", wo.ld);
wo.ld._x = 265;
wo.ld._y = 15;
//Crear Componentes
crearLabel( wo, 15, 15, "Articulo: " );
crearLabel( wo, 60, 35, pressed.Articulo, 0x000000 );
crearLabel( wo, 15, 55, "Precio:" );
crearLabel( wo, 60, 70, pressed.Precio, 0x000000 );
crearLabel( wo, 15, 90, "Descripcion:" );
wo.createClassObject( TextArea, "descripcion_txa", wo.getNextHighestDepth(), {_x:15, _y:105, _width:230, _height:200});
wo.descripcion_txa.text = pressed.Descripcion;
}
function crearLabel( clip:MovieClip, x:Number, y:Number, text:String, color:Number ):TextField
{
var l:Number = clip.getNextHighestDepth();
clip = clip.createEmptyMovieClip("c"+l, l);
clip._x = x;
clip._y = y;
var texto:TextField = clip.createTextField("tx", 0, 0, -11, 200, 22);
texto.wordWrap = true;
texto.multiline = true;
texto.text = text;
//Formato de texto
texto.setTextFormat( new TextFormat("Arial", 12, color?color:0x0000AA, color?false:true) )
return texto;
}
function setArea( clip:MovieClip, w:Number, h:Number, color:Number, alpha:Number ):Void
{
//Dibujamos un cuadrado
clip.clear();
clip.beginFill( color?color:0, alpha?alpha:0 );
clip.moveTo( 0, 0 );
clip.lineTo( w, 0 );
clip.lineTo( w, h );
clip.lineTo( 0, h );
clip.endFill();
}