par
sknano » 01 oct. 2010, 21:18
bonsoir tlm,
j'ai besoin d'aide
j'ai un fichier flash affiche a certain endroit du texte et image (lien) qui sont stoqué dans un xml
voici mon code flash :
var xmlLoader:URLLoader = new URLLoader();
var xmlData:XML = new XML();
xmlLoader.addEventListener(Event.COMPLETE, LoadXML);
xmlLoader.load(new URLRequest('
http://www.xxxxxxxxxx.com/ds/xxxxxxxx/b ... roduit.xml'));
Code : Tout sélectionner
function LoadXML(e:Event):void {
xmlData = new XML(e.target.data);
for(var i:int=0;i<xmlData.produit.length();i++)
{
loadMedia(xmlData.produit[i].picture1);
titre.titre.text=xmlData.produit[i].titre1;
price.price.text=xmlData.produit[i].price1+' €';
encart.encart.text=xmlData.produit[i].encart1;
carac.carac.text=xmlData.produit[i].carac1;
}
}
mon code xml:
Code : Tout sélectionner
<?xml version="1.0" encoding="ISO-8859-1"?>
<root>
<produit>
<picture1>http://www.xxxxxxx.com/ds/xxxxx/bordeaux/xml/produit/img/produit1.jpg</picture1>
<titre1>Gilet Airbag Neck DPS SPIDI</titre1>
<price1>309,90</price1>
<encart1>EXCLU</encart1>
<carac1>Gilet airbag Neck DPS – protection cervicales par coussin double – protection poitrine - noir – du S au 3XL</carac1>
<picture2>http://www.xxxxxxx.com/ds/xxxxxxx/bordeaux/xml/produit/img/produit2.jpg</picture2>
<titre2>Eight Jacket RACER </titre2>
<price2>339,00</price2>
<encart2>PROMO</encart2>
<carac2>blouson cuir homme – étanche et respirant – doublure amovible Polarterc High loft – protections coudes et épaules homologuées D3O – noir/anis – du L au XXL</carac2>
<picture3>http://www.xxxxxx.com/ds/xxxxxxxx/bordeaux/xml/produit/img/produit3.jpg</picture3>
<titre3>Blouson Success Story IXON</titre3>
<price3>139,00</price3>
<encart3>PROMO</encart3>
<carac3>blouson textile homme - étanche – doublure hiver intégrale amovible – protections coudes et épaules homologuées – noir/rouge – du S au 3XL</carac3>
pour certaines raisons ( je doit creer une page php avec simple xml pour administrer ce fichier xml) je doit changer la structure du xml
je souhaite que cela devienne :
Code : Tout sélectionner
<?xml version="1.0" encoding="ISO-8859-1"?>
<root>
<produit>
<produit id="Ecran blouson">
<produit>Produit n°1</produit>
<picture>grand.jpg</picture>
<titre>Lady Ella BERING</titre>
<price>119,00</price>
<encart>PROMO</encart>
<carac>1 a 6</carac>
<produit id="Ecran casque">
<produit>Produit n°1</produit>
<picture>produit2.jpg</picture>
<titr2>Eight Jacket RACER </titre>
<price>290,00</price>
<encart>PROMO</encart>
<carac> L au XXL</carac>
</produit>
</root>
g
je n'arrive pas a adapter le code as
quelqu'un peu m'aider???
merci
g
g
g
g
bonsoir tlm,
j'ai besoin d'aide
j'ai un fichier flash affiche a certain endroit du texte et image (lien) qui sont stoqué dans un xml
voici mon code flash :
var xmlLoader:URLLoader = new URLLoader();
var xmlData:XML = new XML();
xmlLoader.addEventListener(Event.COMPLETE, LoadXML);
xmlLoader.load(new URLRequest('http://www.xxxxxxxxxx.com/ds/xxxxxxxx/bordeaux/xml/produit/produit.xml'));
[code]function LoadXML(e:Event):void {
xmlData = new XML(e.target.data);
for(var i:int=0;i<xmlData.produit.length();i++)
{
loadMedia(xmlData.produit[i].picture1);
titre.titre.text=xmlData.produit[i].titre1;
price.price.text=xmlData.produit[i].price1+' €';
encart.encart.text=xmlData.produit[i].encart1;
carac.carac.text=xmlData.produit[i].carac1;
}
}
[/code]
mon code xml:
[code]<?xml version="1.0" encoding="ISO-8859-1"?>
<root>
<produit>
<picture1>http://www.xxxxxxx.com/ds/xxxxx/bordeaux/xml/produit/img/produit1.jpg</picture1>
<titre1>Gilet Airbag Neck DPS SPIDI</titre1>
<price1>309,90</price1>
<encart1>EXCLU</encart1>
<carac1>Gilet airbag Neck DPS – protection cervicales par coussin double – protection poitrine - noir – du S au 3XL</carac1>
<picture2>http://www.xxxxxxx.com/ds/xxxxxxx/bordeaux/xml/produit/img/produit2.jpg</picture2>
<titre2>Eight Jacket RACER </titre2>
<price2>339,00</price2>
<encart2>PROMO</encart2>
<carac2>blouson cuir homme – étanche et respirant – doublure amovible Polarterc High loft – protections coudes et épaules homologuées D3O – noir/anis – du L au XXL</carac2>
<picture3>http://www.xxxxxx.com/ds/xxxxxxxx/bordeaux/xml/produit/img/produit3.jpg</picture3>
<titre3>Blouson Success Story IXON</titre3>
<price3>139,00</price3>
<encart3>PROMO</encart3>
<carac3>blouson textile homme - étanche – doublure hiver intégrale amovible – protections coudes et épaules homologuées – noir/rouge – du S au 3XL</carac3>
[/code]
pour certaines raisons ( je doit creer une page php avec simple xml pour administrer ce fichier xml) je doit changer la structure du xml
je souhaite que cela devienne :
[code]<?xml version="1.0" encoding="ISO-8859-1"?>
<root>
<produit>
<produit id="Ecran blouson">
<produit>Produit n°1</produit>
<picture>grand.jpg</picture>
<titre>Lady Ella BERING</titre>
<price>119,00</price>
<encart>PROMO</encart>
<carac>1 a 6</carac>
<produit id="Ecran casque">
<produit>Produit n°1</produit>
<picture>produit2.jpg</picture>
<titr2>Eight Jacket RACER </titre>
<price>290,00</price>
<encart>PROMO</encart>
<carac> L au XXL</carac>
</produit>
</root>[/code]
g
je n'arrive pas a adapter le code as
quelqu'un peu m'aider???
merci
g
g
g
g