Précédent   Forum des professionnels en informatique > Webmasters - Développement Web > Flash/Flex > Flash
Flash Forum d'entraide sur la technologie Flash (Cours, FAQs, Sources)
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 15/06/2007, 13h57   #1
Invité de passage
 
Inscription : juin 2007
Messages : 4
Détails du profil
Informations forums :
Inscription : juin 2007
Messages : 4
Points : 2
Points : 2
Par défaut affichage d'une liste d'items sur 2 colonnes

bonjour,

j'ai un flash qui affiche une liste d'items (sous forme d'un clip qui se répète) provenant d'un flux xml.
L'affichage se fait actuellement simplement sur une colonne en listant du 1er au dernier item.
Je voudrai modifier cet affichage en le scindant en 2 colonnes. J'ai essayé plusieurs choses mais je n'y suis pas arrivé pas.

mcProd étant le clip se répétant, qui lui même se trouve dans un clip mcProdList.

voici un bout de mon code :

// ::::::::::::::::::::::::::::::::::::::::::::::: Niveau liste des produits :::::::::::::::::::::::::::::::
// A shortcut to top level nodes
var TopNodes:Array = thisObj.listXML.firstChild.childNodes;

// Compteur de fiche produit créée
thisObj.nbProduit = 0;//TopNodes.length;


// ::::::::::::::::::::::::::::::::::::::::::::::: Niveau produit ::::::::::::::::::::::::::::::::::::::::::
// For each child node in the XML file...
for(var i:Number = 0; i < TopNodes.length; i++)
{
/*if( ((Level1 == TopNodes[i].attributes['niveau1']) || (Level1 == ""))
&& ((Level2 == TopNodes[i].attributes['niveau2']) || (Level2 == ""))
&& ((Level3 == TopNodes[i].attributes['niveau3']) || (Level3 == "")) )*/
if( ((Level1 == TopNodes[i].attributes['niveau1']))
&& ((Level2 == TopNodes[i].attributes['niveau2']))
&& ((Level3 == TopNodes[i].attributes['niveau3'])) )
{
// Attach the list_item symbol from the library and set up it
var mcProd:MovieClip = thisObj.mcProdList.Container.attachMovie("list_item", "list_item_"+thisObj.nbProduit, thisObj.nbProduit);

// MAJ du compteur de fiche produit créée
thisObj.nbProduit++;

// Mémo des attributs du noeud "produit" dans un attribut du MovieClip containeur de la fiche produit
mcProd.attributs = TopNodes[i].attributes;
//mcProd.attributs.niveau1
//mcProd.attributs.niveau2
//mcProd.attributs.niveau3

// Récupération de toutes les données d'un produit
// Use firstChild to iterate through the child nodes of the current node
for(var prodNode:XMLNode = TopNodes[i].firstChild; prodNode != null; prodNode = prodNode.nextSibling)
{
// Si c'est un noeud de bon type (ELEMENT_NODE)... [il'y pas de raison que non !]
if(prodNode.nodeType == 1)
{
// Mémo de la valeur dans un attribut du MovieClip containeur de la fiche produit
if(prodNode.firstChild.nodeValue == undefined)
{
mcProd[prodNode.nodeName] = "";
}
else
{
mcProd[prodNode.nodeName] = prodNode.firstChild.nodeValue;
}
}
}


// Set up each top menu attributes...
oXY = {x:thisX, y:thisY};
mcProd.globalToLocal(oXY);
mcProd._x = oXY.x;//thisX;
mcProd._y = oXY.y;//thisY;
mcProd.Libelle.iniWidth = mcProd.Libelle._width;
mcProd.Libelle.autoSize = "left";
mcProd.Libelle.text = mcProd["titre"];
mcProd.Marque.iniWidth = mcProd.Marque._width;
mcProd.Marque.autoSize = "left";
mcProd.Marque.text = mcProd["marque"];
//mcProd.Description.text = mcProd["description"];
mcProd.DescriptionWeb.text = mcProd["description_web"];
//mcProd.Delai.text = mcProd["ChaineDelai"];
mcProd.Prix.text = mcProd["prix_vente_ttc"]+" €";
//mcProd.ref = mcProd["id_produit"];
mcProd.ImgZoomX = mcProd.ImgZoom._x;
mcProd.ImgZoomY = mcProd.ImgZoom._y;
mcProd.ImgZoomHeight = mcProd.ImgZoom._height;
mcProd.ImgZoomWidth = mcProd.ImgZoom._width;
_root.txtnbpr.text = nbProduit;


// Prepare next element position

thisY += mcProd._height;
bartcc est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 15/06/2007, 14h26   #2
Rédacteur/Modérateur
 
Avatar de beekeep
 
Homme
Développeur informatique
Inscription : octobre 2006
Messages : 1 606
Détails du profil
Informations personnelles :
Sexe : Homme
Âge : 26
Localisation : France, Haute Garonne (Midi Pyrénées)

Informations professionnelles :
Activité : Développeur informatique

Informations forums :
Inscription : octobre 2006
Messages : 1 606
Points : 2 234
Points : 2 234
Lut,

apparenment il s'agit d'adapter le pti algo pour avoir deux colonnes ;

il faut savoir comment compte tu placer les elements,

C1 | C2
C3 | C4
C5 | C6

ou

C1 | C4
C2 | C5
C3 | C6

j'ai pas trop compri le passage pour placer le clip a la bonne position :

Code :
1
2
3
4
oXY = {x:thisX, y:thisY};
mcProd.globalToLocal(oXY);
mcProd._x = oXY.x;//thisX;
mcProd._y = oXY.y;//thisY;
mais il suffit d'appliquer un modulo pour ce genre de choses.

+
beekeep est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 15/06/2007, 15h26   #3
Invité de passage
 
Inscription : juin 2007
Messages : 4
Détails du profil
Informations forums :
Inscription : juin 2007
Messages : 4
Points : 2
Points : 2
c'est bon..
je me servait bien d'un modulo mais je l'avais mis dans une boucle, du ça partais un peu n'importe comment.

du coup ça marche bien comme ça :
Code :
1
2
3
4
5
 
if (nbProduit%2 == 0) {
thisY += mcProd._height;
mcProd._x += mcProd._width;
}
merci.
bartcc est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité Cette discussion est résolue.
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 12h05.


 
 
 
 
Partenaires

Hébergement Web