PDA

View Full Version : Two Listbox Problem


Northern
03-01-2006, 07:55 PM
Hi everyone. I'm not a professionnal of ActionScript but I have some bases.
Here is my problem; I need to create two different listbox in the same animation. When the user make is choise in the list of the listbox, an image appear. (I'm working with the _alpha properties)
The first listbox work very well but when the user make is choise in the second listbox, nothing appear.
I know that my english is not very good, so here is my script, maybe you'll understand something ;P

Script of the first listbox (work very well)

// 1.

list.addItem("Rouge");
list.addItem("Bleue");
list.addItem("Noire");

// 2

function displayDetails(c) {
textbox.text = c.getSelectedItem().label+" :";
var j = c.getSelectedItem().label;
texte.text = "**"+j+"**";
if (j=="Bleue") {
setProperty("BodyIbanezBleu", _alpha, "100");
setProperty("BodyIbanezRouge", _alpha, "0");
setProperty("BodyIbanezNoire", _alpha, "0");
}
if (j=="Rouge") {
setProperty("BodyIbanezBleu", _alpha, "0");
setProperty("BodyIbanezRouge", _alpha, "100");
setProperty("BodyIbanezNoire", _alpha, "0");
}
if (j=="Noire") {
setProperty("BodyIbanezBleu", _alpha, "0");
setProperty("BodyIbanezRouge", _alpha, "0");
setProperty("BodyIbanezNoire", _alpha, "100");
}
}

// 3

list.setChangeHandler("displayDetails");





Script of the second listbox ( doesn't work )

// 1.

list2.addItem("A");
list2.addItem("B");
list2.addItem("C");

// 2

function displayDetails(c) {
textbox.text = c.getSelectedItem().label+" :";
var k = c.getSelectedItem().label;
texte.text = "**"+k+"**";
if (k=="A") {
setProperty("BodyIbanezBleu", _alpha, "100");
setProperty("BodyIbanezRouge", _alpha, "0");
setProperty("BodyIbanezNoire", _alpha, "0");
}
if (k=="B") {
setProperty("BodyIbanezBleu", _alpha, "0");
setProperty("BodyIbanezRouge", _alpha, "100");
setProperty("BodyIbanezNoire", _alpha, "0");
}
if (k=="C") {
setProperty("BodyIbanezBleu", _alpha, "0");
setProperty("BodyIbanezRouge", _alpha, "0");
setProperty("BodyIbanezNoire", _alpha, "100");
}
}

// 3

list.setChangeHandler("displayDetails");




Note that I changed the occurence name of the two listbox.

I wish that you understand something !

Thank You
Northern