dcsimg
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: data elements with getSelectedItem() in MX2004

  1. #1
    Member
    Join Date
    Jan 2004
    Posts
    43

    data elements with getSelectedItem() in MX2004

    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!!

  2. #2
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    V2 components do not have the same structure than V1. for more info check in your help files, or at macromedia.com/support/flash on the behaviors of the new components.

    try this (non tested):

    code:
    compPassed.change = function(evt:Object) {
    var record = evt.target.selectedItem;
    };
    compPassed.addEventListener("change", compPassed);



    gparis

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center