Ver Mensaje Individual
  #2 (permalink)  
Antiguo 27/05/2009, 16:39
Avatar de Lynxcraft
Lynxcraft
 
Fecha de Ingreso: noviembre-2007
Ubicación: yecla murcia
Mensajes: 1.346
Antigüedad: 16 años, 6 meses
Puntos: 51
Respuesta: Añadir a la seleccion productos

Código PHP:
import flash.events.*;
import flash.net.*;
import flash.utils.*;
import flash.events.MouseEvent;
import flash.display.Loader;
import flash.net.URLRequest;
var 
LoaderList:URLLoader =new URLLoader();
var 
loadImg:Loader=new Loader();//variable para imagen principal
var loadImg2:Loader=new Loader();//variable para imagen secundaria
var loadImg3:Loader=new Loader();//variable para imagen novedad
var myXML:XML=new XML();
var 
cont:Number=0;
var 
tiempo:Timer=new Timer(6000,0);
//funcion para repetir la escena, como si fuera un boton,pero sin darle al boton.automatico timer
var idNum:Number=0;
// ESTE CODIGO DE ABAJO ES PARA LAS PROMOCIONES
var LoaderList2:URLLoader =new URLLoader();
var 
myXML2:XML=new XML();
var 
cont2:Number=0;
var 
tiempo2:Timer=new Timer(6000,0);
var 
idNum2:Number=0;
//AQUI TERMINO LAS PROMOCIONES
// PRimero Piesa cuantas funciones van hacer li mismo 
// por ejemplo el tiempo simepre va esta funcionando asi que no tiene que estar dentro de todas las fuciones
tiempo.addEventListener(TimerEvent.TIMERmovimiento);

function 
CargaListaContenido(ruta) {
    
//AQUI EL PHP ES DE LAS NOVEDADES
    
LoaderList=new URLLoader(new URLRequest(ruta));
    
LoaderList.addEventListener(Event.COMPLETExmlLoaded);
    
tiempo.start();
}

function 
CargaListapromociones(ruta) {
    
//AQUI EL PHP ES DE LAS PROMOCINES
    
LoaderList2=new URLLoader(new URLRequest(ruta));
    
LoaderList2.addEventListener(Event.COMPLETExmlLoaded2);
    
tiempo2.start();
}

// haora piesa que botones tiene que hacer cada evento


promociones2.addEventListener(MouseEvent.MOUSE_DOWN,CaLiproBoton)
function 
CaLiproBoton(event:Event):void{
    
CargaListapromociones("http://80.36.206.105/smp/PHY/promociones.php")
}

function 
movimiento(event:TimerEvent):void {
    
cont++;
    if (
cont>myXML.child("codigo").length()-1) {
        
cont=0;
    }
    
MuestraArticulos(cont);
}
function 
MuestraArticulos(id:Number) {
    
loadImg=new  Loader();
    
loadImg2=new Loader();
    
loadImg3=new Loader();
    
loadImg.load(new URLRequest(myXML.child("imagenprincipal")[id]));
    
loadImg2.load(new URLRequest(myXML.child("imagensecundaria")[id]));
    
loadImg3.load(new URLRequest(myXML.child("novedadimagen")[id]));
    
loadImg.contentLoaderInfo.addEventListener(Event.COMPLETEredimenciona);
    
loadImg2.contentLoaderInfo.addEventListener(Event.COMPLETEredimenciona);
    
loadImg3.contentLoaderInfo.addEventListener(Event.COMPLETEredimenciona);
    
contenedor.addChild(loadImg);
    
contenedor2.addChild(loadImg2);
    
contenedor3.addChild(loadImg3);
    
addChild(contenedor3);
    
addChild(contenedor2);
    
addChild(contenedor);
    
codigoproductos.text=myXML.child("codigo")[id];
    
nombreproductos.text=myXML.child("nombre")[id];
    
precioespecialproductos.text=myXML.child("precioespecial")[id]+" €";
    
descrproductos.text=myXML.child("descripcion")[id];
    
observaproductos.text=myXML.child("observaciones")[id];
    
pvpproductos.text=myXML.child("pvp")[id]+" €";
    
fechaproductos.text=myXML.child("fecha")[id];
    
idNum =Number(myXML.child("num")[id])
    ;
    
cont=id;
    if (
cont>myXML.child("codigo").length()) {//vuelve a empezar
        
cont=0;
    }
}
function 
onClick(event:MouseEvent):void {
    var 
request:URLRequest=new URLRequest("http://80.36.206.105/smp/PHY/creandopdf.php?num="+String(idNum));
    
navigateToURL(request,"_blank");

}
function 
xmlLoaded(event:Event):void {
    
myXML=XML(LoaderList.data);
    
MuestraArticulos(0);
    
boton_recibir.addEventListener(MouseEvent.MOUSE_DOWN,EventosDeBoton);
    
siguiente.addEventListener(MouseEvent.MOUSE_DOWN,EventosDeBoton);
    
anterior.addEventListener(MouseEvent.MOUSE_DOWN,EventosDeBoton);
    
btnpdf.addEventListener(MouseEvent.CLICKonClick);
}

function 
redimenciona(event:Event):void {
    
loadImg.x=10;
    
loadImg.y=50;
}

function 
EventosDeBoton(event:Event):void {
    switch (
event.currentTarget) {
        case 
boton_recibir :
            
MuestraArticulos(0);
            break;
        case 
siguiente :
            
cont++;
            if (
cont > (myXML.child("codigo").length()-1)) {
                
cont=0;
            }
            
MuestraArticulos(cont);
            break;
        case 
anterior :
            
cont-=1;
            if (
cont<0) {
                
cont=myXML.child("codigo").length()-1;
            }
            
MuestraArticulos(cont);
            break;
    }
}

CargaListaContenido("http://80.36.206.105/smp/PHY/datosxmlCP.php"); 
__________________
Sobran las ideas cuando faltan ganas de trabajar en ellas
Lynxcraft