# Xml - Dynamic caption

**URL:** <https://forum.kirupa.com/t/xml-dynamic-caption/118965>\
**Category:** Uncategorized\
**Created:** [August 10, 2004, 3:23pm UTC](https://forum.kirupa.com/t/xml-dynamic-caption/118965 "2004-08-10T15:23:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![asthyanax](https://avatars.discourse-cdn.com/v4/letter/a/50afbb/32.png) [@asthyanax](https://forum.kirupa.com/u/asthyanax)\
**Post date:** [August 10, 2004, 3:23pm UTC](https://forum.kirupa.com/t/xml-dynamic-caption/118965/1 "2004-08-10T15:23:36Z")

</div>

Hi,  
I have a little problem and i don’t really know how to do what i want. I have an xml file with url of pictures and text for the comment of those pics. I create thumbnails buttons with an attachmovie on my main scene, all this works great but i have also a kind of tooltip, and i want that each time i roll over the button, the text change with the good atribute of my xml file. I do something like this but it doesn’t work :

```auto

function attach_btn() { _root.createEmptyMovieClip("thumb_mc", 1); 
thumb_mc._x = 10; 
thumb_mc._y = 10; 
//attach buttons on the container 
Array_text = new Array();	
Array_text.push(MyXml.firstChild.childnodes.attributes.TEXT);
trace(Array_text); 
var nb_pic = MyXml.firstChild.childnodes.length; 
for (i=0; i<nb_pic; i++) {	
thumb_mc.attachMovie("Btn", "Btn"+i, i, {_y:i*35});	
thumb_mc["Btn"+i].onRollOver=function(){		
this.GotoAndPlay("over") ;		
caption.mc._visible=true ;		
caption_mc.caption_text.text=Array_text* ;	
}	
} 
}

```

I hope my english is quite understandable and i hope someone can help me with that problem.  
Thank’s.  
chris

---

<div class="post-metadata">

**Author:** ![Beebs](https://avatars.discourse-cdn.com/v4/letter/b/47e85d/32.png) [@Beebs](https://forum.kirupa.com/u/Beebs)\
**Post date:** [August 10, 2004, 9:23pm UTC](https://forum.kirupa.com/t/xml-dynamic-caption/118965/2 "2004-08-10T21:23:37Z")

</div>

Quick check of your code:

```auto
caption.mc._visible=true ;		
caption_mc.caption_text.text=Array_text* ;

```

1. Is that suppose to be caption\_mc or caption.mc?

2. have you embed the font in caption\_text?

---

<div class="post-metadata">

**Author:** ![asthyanax](https://avatars.discourse-cdn.com/v4/letter/a/50afbb/32.png) [@asthyanax](https://forum.kirupa.com/u/asthyanax)\
**Post date:** [August 11, 2004, 9:04am UTC](https://forum.kirupa.com/t/xml-dynamic-caption/118965/3 "2004-08-11T09:04:14Z")

</div>

> 

```auto
caption_mc._visible=true ;		
caption_mc.caption_text.text=Array_text* ;

```

1. Is that suppose to be caption\_mc or caption.mc?

2. have you embed the font in caption\_text?

Yes sorry it’s caption\_mc ! Yes i embedded the font but that’s not the problem. I know now where it comes from but i don’t know how to deal with it. in fact,here

```auto
for (i=0; i<nb_pic; i++) {	
thumb_mc.attachMovie("Btn", "Btn"+i, i, {_y:i*35});	
thumb_mc["Btn"+i].onRollOver=function(){		
this.GotoAndPlay("over") ;		
caption_mc._visible=true ;		
caption_mc.caption_text.text=Array_text* ;	
}	
} 

```

i increment the var i but it doesn’t keep the value so the caption doesn’t show anything. I don’t know how i could do that. I have the same problem on my onrelease function cause each time i click or each time i rollover my button i=16 and not 1,2,3…depends on which button.

---

<div class="post-metadata">

**Author:** ![asthyanax](https://avatars.discourse-cdn.com/v4/letter/a/50afbb/32.png) [@asthyanax](https://forum.kirupa.com/u/asthyanax)\
**Post date:** [August 11, 2004, 10:32am UTC](https://forum.kirupa.com/t/xml-dynamic-caption/118965/4 "2004-08-11T10:32:20Z")

</div>

it’s ok now i found the problem. I declared a var to the button i and it works:

```auto
 this.i=i; 
caption_mc.caption_text.text=Array_text[this.i]

```

---

<div class="post-metadata">

**Author:** ![Beebs](https://avatars.discourse-cdn.com/v4/letter/b/47e85d/32.png) [@Beebs](https://forum.kirupa.com/u/Beebs)\
**Post date:** [August 11, 2004, 11:41am UTC](https://forum.kirupa.com/t/xml-dynamic-caption/118965/5 "2004-08-11T11:41:03Z")

</div>

Good to hear it
