# Listbox load images and captions?

**URL:** <https://forum.kirupa.com/t/listbox-load-images-and-captions/102017>\
**Category:** Uncategorized\
**Created:** [February 18, 2004, 10:29pm UTC](https://forum.kirupa.com/t/listbox-load-images-and-captions/102017 "2004-02-18T22:29:00Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Forlorn\_Hope](https://avatars.discourse-cdn.com/v4/letter/f/9d8465/32.png) [@Forlorn\_Hope](https://forum.kirupa.com/u/Forlorn_Hope)\
**Post date:** [February 18, 2004, 10:29pm UTC](https://forum.kirupa.com/t/listbox-load-images-and-captions/102017/1 "2004-02-18T22:29:00Z")

</div>

Ok basically i wana make a list box and when u click somethign in the list box it shows a thumbnailed image and a caption under it. i found this script which i think is the script im lookin for

var loadText = new LoadVars();  
loadText.load(“infolist.txt”);  
loadText.onLoad = function(success) {  
if (success) {  
var listArray = loadText.listdata.split(’,’), i; //split the content of txt file into an array  
for (i=0; i\<listArray.length; i++) {  
list.addItem(listArray\*); //pass the values stored in the array to the listbox  
}  
} else {  
list.addItem(“Error loading contents!”);  
}  
};  
list.setChangeHandler(“myHandler”);  
function myHandler(component) {  
var which = list.getSelectedItem().label;//set which item is selected  
var subData = new LoadVars();  
subData.load(“sublist.txt”);  
subData.onLoad = function(success) {  
if (success) {  
contenttb.text = this[which];//search the txt file for the correspondent info  
imgsp.loadScrollContent(which+".jpg");//load correspondent image  
} else {  
contenttb.text = “Error loading sub data!”;  
}  
};  
}

but im not very good with action script and its liek jibberish to me lol. could someone explain to me what is what? like where do i put the list box items, where i put the image, where i put the caption and such. if someone could help me with this id b :bu:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 20, 2004, 1:10pm UTC](https://forum.kirupa.com/t/listbox-load-images-and-captions/102017/2 "2004-02-20T13:10:18Z")

</div>

_bump_

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 20, 2004, 1:33pm UTC](https://forum.kirupa.com/t/listbox-load-images-and-captions/102017/3 "2004-02-20T13:33:00Z")

</div>

Have you downloaded the FLA i had posted for that script?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 20, 2004, 1:33pm UTC](https://forum.kirupa.com/t/listbox-load-images-and-captions/102017/4 "2004-02-20T13:33:25Z")

</div>

the link was dead

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 20, 2004, 1:35pm UTC](https://forum.kirupa.com/t/listbox-load-images-and-captions/102017/5 "2004-02-20T13:35:36Z")

</div>

PM your email so i can send you the file.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 21, 2004, 2:10am UTC](https://forum.kirupa.com/t/listbox-load-images-and-captions/102017/6 "2004-02-21T02:10:58Z")

</div>

how do i make it so it doesnt order it in alphebetical order? so like it shows it in the order that i write the things down in the txt?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 21, 2004, 2:29am UTC](https://forum.kirupa.com/t/listbox-load-images-and-captions/102017/7 "2004-02-21T02:29:56Z")

</div>

Replace this line:

```auto
var listArray = loadText.listdata.split(',').sort(), i;

```

for

```auto
var listArray = loadText.listdata.split(','), i;

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 21, 2004, 4:44am UTC](https://forum.kirupa.com/t/listbox-load-images-and-captions/102017/8 "2004-02-21T04:44:20Z")

</div>

how do i put links using html in the description box? look at the attachment to see wut i mean

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 21, 2004, 5:04am UTC](https://forum.kirupa.com/t/listbox-load-images-and-captions/102017/9 "2004-02-21T05:04:55Z")

</div>

Use the html and htmlText properties.  
Search the forums for moer info.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 21, 2004, 5:18am UTC](https://forum.kirupa.com/t/listbox-load-images-and-captions/102017/10 "2004-02-21T05:18:38Z")

</div>

ok i thnik i found a code i need to put in my script but i dont konw where to put it. heres my code:

var loadText = new LoadVars();  
loadText.load(“infolist.txt”);  
loadText.onLoad = function(success) {  
if (success) {  
var listArray = loadText.listdata.split(’,’), i; //split the content of txt file into an array  
for (i=0; i\<listArray.length; i++) {  
list.addItem(listArray\*); //pass the values stored in the array to the listbox  
}  
} else {  
list.addItem(“Error loading contents!”);  
}  
};  
list.setChangeHandler(“myHandler”);  
function myHandler(component) {  
var which = list.getSelectedItem().label;//set which item is selected  
var subData = new LoadVars();  
subData.load(“sublist.txt”);  
subData.onLoad = function(success) {  
if (success) {  
contenttb.text = this[which];//search the txt file for the correspondent info  
imgsp.loadScrollContent(which+".jpg");//load correspondent image  
} else {  
contenttb.text = “Error loading sub data!”;  
}  
};  
}

and it said i put this in:  
textboxInstanceName.html = true;

//If you are using the loadText.onLoad = function(),  
then replace the following line with the following:

textboxInstanceName.htmlText = this.textboxVariable;

but i dont konw where to put it. and on the last thing where it says “this.textboxVariable” do ireplace that with the name of my text box?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 21, 2004, 5:23am UTC](https://forum.kirupa.com/t/listbox-load-images-and-captions/102017/11 "2004-02-21T05:23:52Z")

</div>

Please use AS tags.  
This should work.

```auto
var loadText = new LoadVars();
loadText.load("infolist.txt");
loadText.onLoad = function(success) {
if (success) {
var listArray = loadText.listdata.split(','), i; //split the content of txt file into an array
for (i=0; i<listArray.length; i++) {
list.addItem(listArray*); //pass the values stored in the array to the listbox
}
} else {
list.addItem("Error loading contents!");
}
};
list.setChangeHandler("myHandler");
function myHandler(component) {
var which = list.getSelectedItem().label;//set which item is selected
var subData = new LoadVars();
subData.load("sublist.txt");
subData.onLoad = function(success) {
if (success) {
contenttb.html = true;
contenttb.htmlText = this[which];//search the txt file for the correspondent info
imgsp.loadScrollContent(which+".jpg");//load correspondent image
} else {
contenttb.text = "Error loading sub data!";
}
};
}

```
