# Show inside dynamic text the title for multiple images on mouseover

**URL:** https://forum.kirupa.com/t/show-inside-dynamic-text-the-title-for-multiple-images-on-mouseover/331209
**Category:** flash
**Created:** [June 13, 2013, 2:21pm UTC](https://forum.kirupa.com/t/show-inside-dynamic-text-the-title-for-multiple-images-on-mouseover/331209 "2013-06-13T14:21:44Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![AndreiUle](https://avatars.discourse-cdn.com/v4/letter/a/8491ac/32.png) [@AndreiUle](https://forum.kirupa.com/u/AndreiUle)
#### Post date: [June 13, 2013, 2:21pm UTC](https://forum.kirupa.com/t/show-inside-dynamic-text-the-title-for-multiple-images-on-mouseover/331209/1 "2013-06-13T14:21:44Z")

</div>

I have 25 animated movieclips dragged on the stage and they have similar instance names for easier manipulation purposes inside programming using loops. The instance names look like this: image0, image1, image2 and so on.

Each time I go mouseover on one of these unique images I want to show the unique title of that image using for all titles just one dynamic text container named imageTitle.

I have succeeded to make this work image by image but this would require me to copy paste and modify for each image the following code.

```auto

[FONT=arial]image0.onRollOver = function() { 
    imageTitle.text = "First image title";
    imageTitle.textColor = 0x000000; // setting the text color here
  }; 

image0.onRollOut = function() {  
    imageTitle.text = "Choose an image";
    imageTitle.textColor = 0x000000;
}; [/FONT]

```

**Question:** The above code would work but seems redundant to me. Since I have similar instance names (image0, image1, …,image24), how can I put this code inside a loop or something in order to work for all images without repeating this code 25 times.

**Update:** I have added an array to the project that contains all the titles:

```auto
var imagesTitles = new Array("First image title", "Second image title", ....);

```
