When i have to add more than one data i like to use objects rather than
arrays like so
var obj:Object = new Object();
obj.name = "foo";
obj.age = 18;
obj.weight = 500; //lbs pretty big !
lista.addItem ({label:"Shown on list",data:obj});
// then to get the data.
age = lista.selectedItem.data.age;
name = lista.selectedItem.data.name;
isFat = (lista.selectedItem.data.weight > 300); //boolean
Array's work too but i find objects easier to read but that's may just be.
On 9/1/06, Arul Prasad M L <[EMAIL PROTECTED]> wrote:
AFAIK, addItem takes only the label and ONE data element.
To save 2 data elements into the data part, you can make an array with
both
the values, and add that array as the data.
Like this:
lista.addItem(categorias[n + 1], [categorias[n + 0], categorias[n + 3]])
Now, to access the second element, you can access it as
lista.sellectedItem.data[1]
~Arul Prasad.
On 9/1/06, MJorge <[EMAIL PROTECTED]> wrote:
>
> Need a tiny help here folks,
>
> I have a listBox which i am inserting items with one label and two
values
> of
> data in it.
>
> Like this:
>
> lista.addItem (categorias[n + 1], categorias[n + 0], categorias[n + 3]);
>
> Now, how can i get the value of my data (2nd one) ?!
>
> At first i haded only one value in the data and was doing this:
>
> foto = _root.categoria1.lista.getItemAt (z).data; (which was (is)
> working,
> but now i need to had another value, how can i get the second one?)
>
> Thanks,
>
> --
> ------------------------------------------------
> Mário Jorge
> Icq: 164987050
> Msn: [EMAIL PROTECTED]
> Blog: http://www.beedigital.net/blog
> ------------------------------------------------
> _______________________________________________
> [email protected]
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com
>
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
--
marshall.
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com