Welcome, Guest
  • Author Topic: Need to call up data  (Read 2046 times)

    jiffyloop

    • Server what's that
    • *
    • Posts: 22
    • Flash-db Rules
      • View Profile
      • Email
    Need to call up data
    « on: 07/10/02, 14:47 »
    I'm trying to use the source code that Jeff put up regarding comboboxes and loading data from a text file using LoadVars. I want to be able to select something from the list and extract the data from it. I'm having a hard time calling it. Here is what I have:

    function loadBox() {
       popupholder.loadMovie ("jobPopup.swf");
       graphicNumber = this._name.substr(-1)
    trace("filename = " + DataRow) // I want to call this file up
       trace(reviewFiles_lb.getSelectedItem());
    }

    rv = new LoadVars();
    rv.onLoad = AddItems;
    rv.load("jobs_iit.txt");

    function AddItems() {
       numItems = rv.NumItems;
       for (i = 0; i < numItems; i++) {
          var Name = eval("rv.jobName" + i);
           var DataRow = eval("rv.fileName" + i);
          var Desc = eval("rv.Desc" + i);
          var DataProvider = {Link:DataRow, desc:Desc};
          reviewFiles_lb.addItem(Name, DataProvider);
       }
       reviewFiles_lb.setChangeHandler("loadBox");
    }

    As you can see by my trace command in the loadBox function, thats what I want to call up, but it only calls up the last data in the list.

    Any help would be appreciated.

    Jiffy


    Flash-db

    • Administrator
    • Systems Administrator
    • *****
    • Posts: 1876
      • View Profile
      • Flash-db.com
    Re:Need to call up data
    « Reply #1 on: 07/10/02, 15:18 »
    You would need something like this:


    trace("filename="+reviewFiles_lb.getSelectedItem().data["Link"]);


    -----------
    When you added whatever value was in DataRow to the Dataprovider, you added it as

    var DataProvider = {Link:DataRow, desc:Desc};

    ok so now if you want to reference that data you have to reference it like an Object sort of like:

    myObject.data["Link"];
    in this case it's you are specifying the selected item from the combo box:
    myObject.getSelectedItem().data["Link"];

    or
    myObject.getSelectedItem().data["desc"];

    Is that what you mean.

    It takes a bit to get used to how to reference all these things - but it makes things really easy in the future.  I don't think I did a very good job of explaining it their, but hopefully you get the point.


    Flash-DB