PDA

View Full Version : list box event problem


erika
07-07-2004, 12:06 PM
Hi everyone,

I've taken an existing code from this forum for defining a list box component because I have no idea of how I would write one from scratch myself. Sorry! I'm in the process of learning.

Problem: I have pasted the code below. Instead of making each selection open a text file with the same name as the array, I would like each selection to make a text box appear (with different x & y coordinates). I guess the text box would have the same name as each array in the instance name right?

I hope that some actionscripter can help me out as I would really appreciate it while I'm still learning.

Thanks



stop();
// Create slides
//*
name_arr = new Array("Japan", "Kazakhstan", "Kiribati", "Korea", "Kyrgyzstan", "Lao Peoples Democratic Republic", "Macau", "Malaysia", "Maldives", "name7");
listArray = new Array()
for (i = 0 ; i < 10 ; i++) {
// listArray.push ({label:"asd" + i, data:"asd" + i+ ".txt"});
listArray.push ({label:name_arr[i], data:name_arr[i] + ".txt"});
}
//*/

// Create list box
this.attachMovie("FListBoxSymbol", "newSlides", 18, {_x:167, _y:164});
this.newSlides.setSize(315, 140);
this.newSlides.setDataProvider(listArray);
this.newSlides.setChangeHandler("loadTXT");

function loadTXT(component)
{
//loadVariablesNum (component.getValue(), 0);
data_lv = new LoadVars();
data_lv.onLoad = function (ok)
{
if (ok)
{
trace("txt_userID = " + this.txt_userID);
trace("txt_name = " + this.txt_name);
}
}
data_lv.load(component.getValue());
}