←  Adobe Flash

Pixel2Life Forum

»

add item to combobox

Garethfc's Photo Garethfc 16 Sep 2005

mi english really sucks sorry

I use a combobox in mi rpg to recolect items
i am using the macromedia combobox who comes with flash mx and i need a code for this:
when character histtest "diamond" (for example) add an item "diamonds" in combobox

the part of hittest and movement is ok, but i cant obtain a new item in mi combobox =(

if you have and idea, please help me


bye and sorry for mi english again
Quote

funkysoul's Photo funkysoul 17 Sep 2005

this should do it

my_combobox.addItem(itemname);
Quote

Garethfc's Photo Garethfc 17 Sep 2005

its dosent works...
remember is flash mx
i put:
onClipEvent (enterFrame) {
 if (_root.character.hitTest (this)) {
my_combobox.addItem(diamond);
}
}

i have a character named "character"
i have a combobox named "my_comboboox"

and the hittest works perfect
so if someone knows an answers, please help me =)
Quote

funkysoul's Photo funkysoul 18 Sep 2005

I'm pretty sure that this should also work for MX

combobox.addItem("label", data);
Quote

Garethfc's Photo Garethfc 18 Sep 2005

=/ i am doing something wrong,
incluse when i writ
combobox.addItem(
near the code it appears a tex
"("label", data)"
but it dont works =(
Quote

funkysoul's Photo funkysoul 18 Sep 2005

it should be
combobox.addItem("label",data);
and not
combobox.addItem"("label",data)";

you can also send me the fla file for checking..
Edited by funkysoul, 18 September 2005 - 03:54 PM.
Quote