Foros del Web » Creando para Internet » Flash y Actionscript »

Añadir a la seleccion productos

Estas en el tema de Añadir a la seleccion productos en el foro de Flash y Actionscript en Foros del Web. Hola, me gustaria saber como puedo en flash cs3 hacer una cosa. Quiero que al pinchar en un boton que se llama AÑADIR A LA ...
  #1 (permalink)  
Antiguo 27/05/2009, 15:12
 
Fecha de Ingreso: abril-2009
Mensajes: 173
Antigüedad: 15 años
Puntos: 0
Añadir a la seleccion productos

Hola, me gustaria saber como puedo en flash cs3 hacer una cosa.
Quiero que al pinchar en un boton que se llama AÑADIR A LA SELECCION, me añada ese producto NOMBRE-REFERENCIA- , los datos son recogidos de una base de datos mediante un php que contiene una lista xml.
Aclarando cuando pinche en añadir seleccion pues si estoy viendo por ejemplo un boligrafo, con una descripcion por ejemplo es de color rojo fino, pues que me los muestre en otro frame
Nombre: boli
Descripcion: color rojo fino.
gracias
[email protected]
Mi codigo flash
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);
var idNum:Number=0
function CargaListaContenido() {
//AQUI EL PHP ES DE LAS NOVEDADES
LoaderList=new URLLoader(new URLRequest("http://80.36.206.105/smp/PHY/datosxmlCP.php"));
LoaderList.addEventListener(Event.COMPLETE, xmlLoaded);
tiempo.addEventListener(TimerEvent.TIMER, movimiento);
tiempo.start();
}
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.C OMPLETE, redimenciona);
loadImg2.contentLoaderInfo.addEventListener(Event. COMPLETE, redimenciona);
loadImg3.contentLoaderInfo.addEventListener(Event. COMPLETE, redimenciona);
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("precioes pecial")[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_DO WN,EventosDeBoton);
siguiente.addEventListener(MouseEvent.MOUSE_DOWN,E ventosDeBoton);
anterior.addEventListener(MouseEvent.MOUSE_DOWN,Ev entosDeBoton);
btnpdf.addEventListener(MouseEvent.CLICK, onClick);
}
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();
  #2 (permalink)  
Antiguo 27/05/2009, 16:39
Avatar de Lynxcraft  
Fecha de Ingreso: noviembre-2007
Ubicación: yecla murcia
Mensajes: 1.346
Antigüedad: 16 años, 5 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
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 13:29.