Flash and ID3 tag support

Discussion in 'Web Design & Coding' started by MSUman4, Jan 5, 2004.

  1. MSUman4

    MSUman4 OSNN Junior Addict

    Messages:
    14
    Location:
    Michigan, USA
    I'm very novice when it comes to Flash, so bare with me. I'm trying to pull the ID3 tag information from an external mp3. I pulled this code directly from Macromedia's web site. My source code is below:

    myTrack = new Sound();
    function Music(){
    myTrack.start();
    if((myTrack.getBytesLoaded() == myTrack.getBytesTotal()) && myTrack.duration > 0){
    tf.text += "Title = " + myTrack.id3.songname +"." + newline;
    tf.text += "Artist = " + myTrack.id3.artist +"." + newline;
    clearInterval (poll);
    }
    }
    myTrack.loadSound("song.mp3", false);
    poll = setInterval(Music, 1000);


    It correctly pulls the two ID3 fields I want and I've tested them by using the "trace()" function. The problem I'm having is outputing the information to a dynamic text box. I want to have a seperate text box for the title of the song and for the artist of the song. Using this code, how do I do that? Please be very descriptive because I'm new at this. Thanks in advance!
     
  2. Zedric

    Zedric NTFS Guru Folding Team

    Messages:
    4,006
    Location:
    Sweden
    Well, knowing nothing about the Flash script language, I'd say you could do this. Create tho boxes called titleBox and artistBox. Then use this code.

    Code:
    myTrack = new Sound();
    function Music(){
      myTrack.start();
      if((myTrack.getBytesLoaded() == myTrack.getBytesTotal()) && myTrack.duration > 0){
        titleBox.text = myTrack.id3.songname;
        artistBox.text = myTrack.id3.artist;
        clearInterval (poll);
      }
    }
    myTrack.loadSound("song.mp3", false);
    poll = setInterval(Music, 1000);