1 Reply Latest reply on Jul 18, 2006 4:07 PM by Newsgroup_User

    Flash list and variables

    Neokase
      Recently I discovered how to load multiple variables into a dynamic textbox using buttons. I'm wondering if I can do the same thing only with a list component.

      Here is the coding for the buttons

      myData = new LoadVars();
      myData.onLoad = function(){
      myText_txt.htmlText = this.myVariable;
      };

      myData.load("myText1.txt");

      b1.onRelease = function() {
      myText_txt.text = _root.myData.myVariable;

      }

      b2.onRelease = function() {
      myText_txt.text = _root.myData.myVariable2;

      }

      Here is the coding I was trying with the list component of course it does not work

      myDP = new Array(
      {label:"myLabel1", data:"myVariable1"},
      {label:"myLabel2", data:"myVariable2"}
      );

      ClistBox.dataProvider = myDP;

      function change(evt) {

      var mySelectedData = evt.target.selectedItem.data;
      myText_txt.text.load(mySelectedData);

      }

      this.ClistBox.addEventListener("change", this);

      Any help would be greatly appreciated. Thanks
        • 1. Re: Flash list and variables
          Level 7
          No need to use an Array if you are adding items to a listBox.

          myLabel1 = "some label";
          myVariable1 = "some data";
          ClistBox.addItem({label:myLabel1, data:myVariable1});


          --


          Dan Mode
          *THE online Radio* http://www.tornadostream.com
          *Must Read* http://www.smithmediafusion.com/blog
          *Flash Helps* http://www.smithmediafusion.com/blog/?cat=11

          "Neokase" <webforumsuser@macromedia.com> wrote in message
          news:e9j3o9$q6a$1@forums.macromedia.com...
          > Recently I discovered how to load multiple variables into a dynamic
          > textbox
          > using buttons. I'm wondering if I can do the same thing only with a list
          > component.
          >
          > Here is the coding for the buttons
          >
          > myData = new LoadVars();
          > myData.onLoad = function(){
          > myText_txt.htmlText = this.myVariable;
          > };
          >
          > myData.load("myText1.txt");
          >
          > b1.onRelease = function() {
          > myText_txt.text = _root.myData.myVariable;
          >
          > }
          >
          > b2.onRelease = function() {
          > myText_txt.text = _root.myData.myVariable2;
          >
          > }
          >
          > Here is the coding I was trying with the list component of course it does
          > not
          > work
          >
          > myDP = new Array(
          > {label:"myLabel1",
          > data:"myVariable1"},
          > {label:"myLabel2",
          > data:"myVariable2"}
          > );
          >
          > ClistBox.dataProvider = myDP;
          >
          > function change(evt) {
          >
          > var mySelectedData = evt.target.selectedItem.data;
          > myText_txt.text.load(mySelectedData);
          >
          > }
          >
          > this.ClistBox.addEventListener("change", this);
          >
          > Any help would be greatly appreciated. Thanks
          >