Problème variable actionscript xml ?

Résolu
mortblake Messages postés 4 Date d'inscription samedi 17 novembre 2007 Statut Membre Dernière intervention 9 novembre 2008 - 5 oct. 2008 à 14:21
cs_Girou Messages postés 1203 Date d'inscription lundi 10 mars 2003 Statut Membre Dernière intervention 23 juillet 2009 - 6 oct. 2008 à 09:45
Bonjour, j'ai un problème en ActionScript2 que je doit résoudre rapidement si possible..

Explication:

Il y a tout d'abord 2 boutons (web et logo), quand on clique dessus des images importer d'un fichier XML s'affiche, quand on clique sur une image (en l'occurence le bouton btn_transparent ) cela doit afficher la même image en taille normal dans une autre fenêtres, pour l'instant sa marche comme prévu. Le problème est que quand j'appuis sur le bouton logo puis sur une des images (différente des images du bouton web évidement), cela m'affiche la même image que dans le bouton web. Normalement la variable (liens) devrait prendre l'attribut link dans le XML ( en bleu) au lieu de l'autre link (en rose). Le problème se situe donc sur le texte en rouge ( le reste n'a pas d'importance).

Donc voilà si vous pouvez m'aider a résoudre ce problèmes, je vous en serrait énormement reconnaissant.
Merci

Voilà le code:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><meta name="ProgId" content="Word.Document" /><meta name="Generator" content="Microsoft Word 10" /><meta name="Originator" content="Microsoft Word 10" /><link rel="File-List" href="file:///C:%5CDOCUME%7E1%5CHP_PRO%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml" /><!--[if gte mso 9]><xml>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:HyphenationZone>21</w:HyphenationZone>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
</w:WordDocument>
</xml><![endif]--><style><!--
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-parent:"";
margin:0cm;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:"Times New Roman";}
@page Section1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 70.85pt 70.85pt;
mso-header-margin:36.0pt;
mso-footer-margin:36.0pt;
mso-paper-source:0;}
div.Section1
{page:Section1;}
--></style><!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Tableau Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Times New Roman";}
</style>
<![endif]-->

 

btn_transparent.onRelease
= function() {

                                                          getURL(liens,"_blank");

                                                         }

/**************************************************************************************************/

web_btn.onRelease=function(){

            id=0;

var
title_xml:XML = new XML();

title_xml.ignoreWhite
= true;

title_xml.load("images.xml");

 

title_xml.onLoad=function(success:Boolean)

{

     if(success){

                         nbPic =
title_xml.firstChild.childNodes.length;

                         loadImage(title_xml.firstChild.childNodes[id].attributes.link);

     }

}

 

function
loadImage (url:String):Void

{          

            var my_mcl:MovieClipLoader = new
MovieClipLoader();

            var mclListener:Object = new
Object();

           

            titre_txt.text =
title_xml.firstChild.childNodes[id].attributes.title;

            text_txt.text =
title_xml.firstChild.childNodes[id].attributes.text;

            = title_xml.firstChild.childNodes[id].attributes.link

           

[........]

          

/***************************************************************************************************/

log_btn.onRelease=function(){

            id=0;

var
title_xml:XML = new XML();

title_xml.ignoreWhite
= true;

title_xml.load("images.xml");

 

title_xml.onLoad=function(success:Boolean)

{

     if(success){

                         nbPic =
title_xml.childNodes[1].childNodes.length;

                         loadImage(title_xml.childNodes[1].childNodes[id].attributes.link);

     }

}

 

function
loadImage (url:String):Void

{          

            var my_mcl:MovieClipLoader = new
MovieClipLoader();

            var mclListener:Object = new
Object();

           

            titre_txt.text =
title_xml.childNodes[1].childNodes[id].attributes.title;

            text_txt.text =
title_xml.childNodes[1].childNodes[id].attributes.text;

           liens =
title_xml.firstChild.childNodes[id].attributes.link;

           



[.....]

Code XML:

<web_img>
    link="web/1.jpg"  title="Bluebox" text="." />
   
   
   
   
   
</web_img>
<logo_img>
   
   
   
   
</logo_img>

1 réponse

cs_Girou Messages postés 1203 Date d'inscription lundi 10 mars 2003 Statut Membre Dernière intervention 23 juillet 2009 2
6 oct. 2008 à 09:45
Salut,

tes 2 boutons donnent le même id (id=0) hors dans un cas c'est bien le noeud 0 qui doit être choisi (pour web) mais pour logo c'est le noeud 1 qui doit être sélectionné.

donc, selon moi :

log_btn.onRelease=function(){
id=1;

@+
3
Rejoignez-nous