2 Replies Latest reply on Sep 21, 2008 12:52 PM by jaabi

    Binding XML to ComboBox

    jaabi
      Hi,

      I'd appreciate any help with the following problem.

      In the method theaterSearchResultHandler(), I'm trying to assign a portion of the xml (returned from an HTTPService call) to the dataProvider property of a ComboBox. I've included both the method and the xml that's returned.

      When I dump event.result, I see the xml is there. But somehow the dataProvider property ends up with an empty object.

      Any suggestions? Thanks much.

      LT
        • 1. Re: Binding XML to ComboBox
          Level 7

          "jaabi" <webforumsuser@macromedia.com> wrote in message
          news:gb4raj$t5c$1@forums.macromedia.com...
          > Hi,
          >
          > I'd appreciate any help with the following problem.
          >
          > In the method theaterSearchResultHandler(), I'm trying to assign a portion
          > of
          > the xml (returned from an HTTPService call) to the dataProvider property
          > of a
          > ComboBox. I've included both the method and the xml that's returned.
          >
          > When I dump event.result, I see the xml is there. But somehow the
          > dataProvider property ends up with an empty object.
          >
          > Any suggestions? Thanks much.
          >
          > LT
          >
          > //my method where I try to assign the Cinema node of the XML object to the
          > dataProvider property of my ComboBox.
          >
          > private function theaterSearchResultHandler(event:ResultEvent):void
          > {
          > appView.gotoMovieEventSelection();
          > saveTrackingInfo(SELECT_CINEMA);
          > appView.theaterComboBox.labelField = 'Name';
          > appView.theaterComboBox.dataProvider =
          > event.result.CinemaSearch.Response.Cinemas.Cinema;
          > }

          try

          event.result.Response.Cinemas.Cinema


          • 2. Re: Binding XML to ComboBox
            jaabi Level 1
            Thanks for the suggestion Amy.

            Turns out my problem was elsewhere: in the HTTPService tag I used to download the XML. I had set the HTTPService's resultFormat property to 'xml'. I didn't realize that Flash automatically converts xml nodes into actionscript objects without the developer having to do anything. Once I removed the resultFormat property and the combobox worked like it should, binding to the resulting array of Cinema objects.

            :)