1 Reply Latest reply on May 23, 2006 7:57 PM by atog

    data to a grid

    truly_great
      I am about at wits end, I hope someone can help me here.

      What I am trying to do is create a small flash rss feed that feeds into a dataGrid, where you can link on the topic to go directly to that URL. There is a ComboBox that lists all the different topics to choose from and a button to activate it.

      I have binded the XMLConnector to the ComboBox, dataGrid, and button. I am having the worst time creating a variable that will change the URL.

      When I go into the bindings area of the Component Inspector, it asks for a URL. When I put a URL there, that URL will populate the dataGrid, but then changing the ComboBox does nothing.

      I figured the way to do it would be do create a variable in ActionScript that would change depending on which ComboBox item they chose. But I can't seem to get that to work. I blanked out the URL area in bindings and put the followiing in ActionScript:

      import mx.controls.*;
      import mx.containers.*;
      import mx.controls.gridclasses.DataGridColumn;
      import mx.data.components.XMLConnector;

      var rss_cb:ComboBox;
      var myDataGrid ataGrid;
      var myReceiveXMLConnector:XMLConnector;

      form = new Object();
      form.change = function(eventObj){
      trace("Value changed to " + eventObj.target.value); //this works just fine
      }
      rss_cb.addEventListener("change", form);

      if(eventObj.target.value != "Authorware"){
      myReceiveXMLConnector.URL = " http://www.macromedia.com/go/rss_authorware"; //this does nothing!
      }

      myReceiveXMLConnector.trigger();

      I have changed the code so many times and tried so many different ways, that I can't think anymore. What am I doing wrong?
        • 1. Re: data to a grid
          atog
          You have a problem with

          if(eventObj.target.value != "Authorware"){

          as the eventObj is passed to the form listener change function & expires at the end of the function (right after your trace statement).

          Try this...

          form = new Object();
          form.change = function(eventObj){
          trace("Value changed to " + eventObj.target.value); //this works just fine

          // MOVED YOUR CODE HERE
          if(eventObj.target.value != "Authorware"){
          myReceiveXMLConnector.URL = " http://www.macromedia.com/go/rss_authorware"; //this does nothing!
          }
          }
          rss_cb.addEventListener("change", form);

          myReceiveXMLConnector.trigger();