2 Replies Latest reply on Aug 22, 2007 9:10 AM by rgames1

    Need help binding XML data in actionscript

      OK - I'm completely new to Flash and Actionscript, so bear with me... :)

      I'm putting together a flash page with lists of .MP3's that are selectable by genre (I'm a composer, mostly for film). For example, the genre types include pop, horror/suspense, ethnic, concert works, etc. For each of those genres there is a list of example tracks. I'm using an XML file to list the genres and associated tracks and the lists work just fine. I also have a track description text display on the page that works just fine, as well. I have all the bindings set up using an XML connector. The two list boxes and text description box are linked via the "bindings" tab in the Component Inspector. All of that works just fine.

      The thing I can't figure out how to do is link the .MP3 file from the XML list to a play button. I can add a behavior that links to a single, pre-defined file but I want the play button to get the filename based on the current genre/track selection. I have bound the play button to the MP3 file path via the XML connector but I can't figure out how to access that filename in the Actionscript.

      So, in short, how do I use Actionscript to get at the filename that is set up in the XML binding? Once I get the filename from the currently selected genre/track, I can just create a sound object from that file and link it to the play button, correct?

      Thanks in advance,

        • 1. Re: Need help binding XML data in actionscript
          Chris Ivey
          Is this an AS2 or an AS3 project? Once you have a handle on the selected object, you should have no problem loading the associated URL; however, how you start playing an .mp3 will vary depending on which environment you're working in.
          • 2. Need help binding XML data in actionscript
            Hi Chris - it's an AS2 project.

            I can play mp3's, I just can't get the filename passed to the AS code that does the playing.

            I set up all of the XML data bindings via the component inspector, so I have no idea how to get to the bindings in AS. But the code to play the mp3 is done in AS. I need to know what AS syntax is used to get at the filename that is associated with the binding done in the component inspector.

            I can display the filename in a text box onscreen, I just don't know how to get at that string in AS because all of the links are set up in the component inspector.