Problem adding itens to a listbox using functions

hi
i am learning to work with sharedobjects in flash mx, and i am trying now do to a little application, and in this application i will use a listbox to do some things, i have a message board that will keep the messages in the sharedobject named “visitas”, i add data with a function, ,here it is:

function salvaMensagens(){
var num = Number(_root.entradas.text);
visitas.data.mensagens[num] = _root.mensagem.text;
visitas.data.visitantes[num][num] = _root.nome.text;
visitas.data.visitantes[num][num + 1] = _root.email.text;
_root.display.text = visitas.data.mensagens.length;
_root.lista.addItem(_root.nome.text, _root.email.text);
//trace(nome.text + " - " + email.text);
visitas.data.flush();
}

this line:
_root.lista.addItem(_root.nome.text, _root.email.text);

it had to add the name digited in the input text field name, and the same with the email, respectivelly , label and data, but my listbox is still empty after several tryes…

please, could someone help?

Hmm… Im a little lost

Help me out here…

You have a listbox, and you want to learn how to add data to it?

What about the sharedobject? Are you using it? What is your sharedobject called? (perhaps you’re not needing it in this example).

Let me know and we’ll help you out.

here is how i call/initialize my sharedobject:

visitas = SharedObject.getLocal(“livroVisitas”);

as i told you, i am starting to learn and i am only doing tests to see it works, in this case i want the user to insert it’s userName, email and a message, the name will be the listbox label, and the email the listbox data, the only problem, i don’t know why, is that the list box are not accepting the insertion inside the funcion salvaMensagens(), i do a for loop out of the function and comment the function line to add item to the list box, and the listbox is succesfully filled, like this:
for(i=0; i < 10; i++){
lista.addItem(i, i);
}
it works fine, but the problem is the function. how can he don’t recognize the name and email?

if you could helpme in this one i would apreciate a lot!