• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Flash and ID3 tag support

MSUman4

OSNN Junior Addict
#1
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
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);
 

Members online

No members online now.

Latest posts

Latest profile posts

Perris Calderon wrote on Electronic Punk's profile.
Ep, glad to see you come back and tidy up...did want to ask a one day favor, I want to enhance my resume , was hoping you could make me administrator for a day, if so, take me right off since I won't be here to do anything, and don't know the slightest about the board, but it would be nice putting "served administrator osnn", if can do, THANKS

Been running around Quora lately, luv it there https://tinyurl.com/ycpxl
Electronic Punk wrote on Perris Calderon's profile.
All good still mate?
Hello, is there anybody in there? Just nod if you can hear me ...
Xie
What a long strange trip it's been. =)

Forum statistics

Threads
61,962
Messages
673,247
Members
89,017
Latest member
Seggar