0 Replies Latest reply on May 18, 2006 8:54 AM by loditferma

    Array from external file ?


      Ok I hope someone can help with this:

      I am trying to get variable label: and data: for a combobox. So I figured I'd have to use an Array and feed it from an external file so that i can easily add or change the content .I can't get it to work. This is what 've done so far.


      // Load array from external file for dataprovider
      // load an external list of variables
      artists = new LoadVars();
      artists.load(" http://www.myserver.com/mytextfile.txt");
      // check to see if its finished loading
      artists.onLoad = function(success) {
      // if its finished loading, split the vars into a new array
      if (success) {
      trace ("succes");
      trace (artists);
      my_dP = artists.split(",");
      for (var i = 0;i<my_dP.length;i++){
      // trace to see how many items are in array
      trace(my_dP );}


      // assign to comboBox
      my_cb.dataProvider = my_dP;

      // Add event listener and event handler function.
      var cbListener bject = new Object();
      cbListener.change = function(evt_obj bject):Void {
      var currentlySelected bject = evt_obj.target.selectedItem;
      trace("data: "+currentlySelected.data);
      trace("label: "+currentlySelected.label);

      my_cb.addEventListener("change", cb Listener);

      //The Txtfile:

      &"{label:"choose..."},{data:" http://www.myserver.com/othertxtfile.txt",label:"Johannes Lauxen"},{data:" http://www.myserver.com/thirdtxtfile.txt",

      //My output returns this:


      I fear the error(s) can be anywhere. Could it simply be the txtfile formatting ?
      If anyone has any ideas, please help. Thnx in advance.