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;
Partager