all groups > flash actionscript > july 2005 >
You're in the

flash actionscript

group:

get data with the the getSelectedItem()


get data with the the getSelectedItem() ericb1
7/26/2005 7:53:48 PM
flash actionscript:
Any help is greatly appreciated! I'm using MX2004pro and trying to get data
using the getSelectedItem() method, but all my variables come back undefined.

I have a simple form/db editing application, with a listbox displaying the
records from my db, and text fields to show/edit the table fields from my db.
When I click on a record in the listbox, I'm trying to populate the text fields
with the corresponding records.

So I populate the listbox:

for (i=0; i < this.n; i++) {
sLabel = padr(this["lastName"+i] + ", " +
this["firstName"+i], 20, " ");
sLabel += "\t" + padr(this["phone"+i], 15, " ") +
"\t" + this["email"+i];
lbxAddressDisplay.addItem(
sLabel,
{contactID:this["contactID"+i],
lastName:this["lastName"+i],
firstName:this["firstName"+i],
phone:this["phone"+i],
email:this["email"+i],
caption:this["caption"+i],
picFile:this["picFile"+i],
contactType:this["contactType"+i]
}
);
}

and then I try to populate the text fields like this:

var record = compPassed.getSelectedItem();
for (var i in gaFields) {
mcFields["dtf" + gaFields.name].text =
record.data[gaFields.name];
}

But they all come back "undefined". Any help as to why I can't get the value
of compPasses.getSelectedItem() is greatly appreciated, thanks!!
Re: get data with the the getSelectedItem() Randy1969
7/26/2005 9:42:09 PM
Where are you setting compPassed, and gaFields?


AddThis Social Bookmark Button